Using Transactions

When you are writing managed objects, just as with T-SQL, it’s important to be aware of the current transaction context under which your code may be running.

Managed database objects have the option of making use of the classes in the new System.Transactions namespace to control transactions. Following are the main objects you use to do this:

Image Transaction.Current—This is a static object of type Transaction that represents the current transaction. You use this object to explicitly roll back the current transaction (using Rollback()). It contains an IsolationLevel property that indicates the current transaction isolation level, ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.