Reputation: 16299
I'm working on a .Net 2.0 application and need to wrap some database transactions in my code. The backend is SQL Server 2008.
I've been away from .net for a few years, the last time I did any transaction processing was in .Net 1.1 with serviced components. I know about TransactionScope, and was wondering if that's a good way to go about things now.
Also, in .Net 3.5 I assume there are other ways to do this, say with WCF? Just wondering if someone could point me toward an article or two. Thanks very much.
Upvotes: 1
Views: 89
Reputation: 294197
TransactionScope is a good way, provided you keep it in check. All ADO.Net providers are aware of the System.Transactions objects so they will enlist properly into a back end transaction when operating under a TransactionScope.
There are two gotchas:
. You can determine the isolation level of an existing transaction using the IsolationLevel property of a transaction.
Technically the last point applies to using any resource manager, but is unlikely you'll use any other RM than your db connections. IF you do, then enlisting into a distributed transaction is the proper action anyway.
Upvotes: 1