Simpler Transactions
Posted by: youve been HAACKED,
on 19 Aug 2009 |
View original | Bookmarked: 0 time(s)
The .NET Framework provides support for managing transactions from code via the System.Transactions infrastructure. Performing database operations in a transaction is as easy as writing a using block with the TransactionScope class. using(TransactionScope transaction = new TransactionScope())
{
DoSomeWork();
SaveWorkToDatabase();
transaction.Complete();
}
At the end of the using block, Dispose is called on the transaction scope. If the transaction has not been completed (in...