References:
http://msdn.microsoft.com/en-us/library/ms172152%28v=vs.90%29.aspx#Y1642
http://stackoverflow.com/questions/4629245/transactionscopeoption-required-or-requiresnew
To understand nested transaction scopes:
http://stackoverflow.com/questions/6987862/understanding-transactionscopeoptions-requiresnew-suppress-required
http://web.archive.org/web/20100829210742/http://www.pluralsight-training.net/community/blogs/jimjohn/archive/2005/06/18/11451.aspx
--Sample
using ( var t1 = new TransactionScope( TransactionScopeOption.Required ) )
{
//MyStuff
using ( var t2 = new TransactionScope( TransactionScopeOption.Suppress) )
{
//MyStuff
using ( var t3 = new TransactionScope( TransactionScopeOption.Required) )
{
//Mystuff
t3.Complete();
}
t2.Complete();
}
t1.Complete();
}
Explanation:
t3 Transaction does the inner TransactionScope take as ambient transaction.
There is nothing else to choose from there, since the scope of t2 is to supress t1, not to create it's own ambient. Therefore at the innermost scope there is only t3 and nothing else.
If t2 would be RequireNew then the innermost scope ambient would be t2 since t3 would join t2.
An stricle related to TransactionScopes:
http://blogs.msdn.com/b/angelsb/archive/2005/02/12/371557.aspx?Redirected=true
Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif
Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator