Using CreateSqlStringAccessor inside current transaction

Feb 2, 2011 at 9:32 PM

I am currently using db.CreateSqlStringAccessor to map select queries into object structures in a c# application.  The method has worked very well for a while but I have hit a snag I am looking for a way to work around.  I need to have the sql run (accessor.execute) inside the current transaction space.  I have a DbTransaction object that is used before to modify some data, but then a query needs to happen via the accessor before the commit is done, and needs to be run in the scope of the current transaction.  For other database methods transaction gets passes along side (example: db.ExecuteDataSet support passing the transaction).

Database object is from Microsoft.Practices.EnterpriseLibrary.Data.Database


Thanks in advance.

Feb 3, 2011 at 12:07 AM

The intended transaction support for accessors is via TransactionScope. There's no support for directly using a DbTransaction.

Can you use a TransactionScope instead? It's a lot easier to manage.