Simple interface to COM+ transactions through Enterprise Service. Makes a code block transactional à la Indigo (evolution will be easier, it's the same API) It's important to make sure that each instance of this class gets Close()'d. Easiest way to do that is with the using statement in C#.
For a list of all members of this type, see TransactionScope Members.
System.Object
TransactionScope
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Don't support nested transaction scope with different transaction options. System.EnterpriseServices.ServiceDomain is available only on - XP SP2 (or higher) - Windows Server 2003 - XP SP1 + Hotfix 828741 and only in .Net 1.1. It CAN'T be used on Windows 2000. http://support.microsoft.com/default.aspx/kb/319177/EN-US/
using (TransactionScope tx = new TransactionScope()) { // Open connection to database 1 // Transaction will be automatically enlist into it // Execute update in database 1 // Open connection to database 2 // Transaction will be automatically enlist into it // Execute update in database 2 // the following code will be executed only if no exception // occured in the above code; since we got here ok, let's vote for commit; tx.Completed(); } when “using” call Dispose on the transaction scope at the end of the “using” code block, the "ambient" transaction will be commited only and only if the Completed method have been called.
Namespace: IBatisNet.Common.Transaction
Assembly: IBatisNet.Common (in IBatisNet.Common.dll)
TransactionScope Members | IBatisNet.Common.Transaction Namespace