This project is read-only.

Adding Ambient/Implicit transactions to NCommon

Apr 7, 2009 at 9:49 PM

I have written an article about the subject which can be found here:

Hope it is useful to other people.

Apr 8, 2009 at 2:34 AM

NCommon does support ambient transactions via TransactionScope. Actualy the support is provided by the underlying connection provider automatically when you use Linq to SQL. When a TransactionScope exists and a UnitOfWorkScope has been stared, the connection initated within the UnitOfWork will auto-enlist to the transactoion. Even if NCommon calls commit on the underlying IDbTransaction, the commit does not happen until the encompassing TransactionScope has not been comitted.

I've added tests to NCommon to demo this. The only advantage I see in your support for ambient transactions is when the underlying provider does not provide auto-enlistment support, which is rare.

Apr 8, 2009 at 11:44 AM
Well, I'm surprised for your words, as I started writing this code just because our existing code did not work when running inside a transactionScope initiated by WCF. (All our internal regression tests using remote transactions failed.)

I guess this might have something to do with WCFs handling of transactions.. Once I have a couple of hours I will try to revert some changes and try this tests again.. I will be back with what I found.