Home All Groups Group Topic Archive Search About

System.Transactions example

Author
25 Apr 2007 11:52 PM
Kevin Burton
To educate my self on how to implement a resource manager an enlist in a
transactions I copied the example code from:

http://msdn2.microsoft.com/en-us/library/ms172153.aspx
Enlisting Resources as Participants in a Transaction

The examples that I have seen with the TransactionScope class and database
servers like SQL automatically tack advantage to the fact that they are run
in a transaction scope yet in building my own resource manager implementing
the IEnlistmentNotification interface I have to explicitly enlist in the
transaction. How does the database server "know" that there is a transaction
scope in place?

Finally in the example I notice that the Prepare is not called untill the
scope ends. (scope.Complete()). I would like to do task A and task B in a
transaction. In the example it shows basically task A running in the Prepare
method. But what if task B was a stored procedure call? Whan would the
prepare, commit, or rollback be called for that task?

Thank you.

AddThis Social Bookmark Button