我对TransactionScopeOption有3个问题。 要求把我 driving起,我不得不在网上找到他们。
A. Im having hard time to think When in reality I have to write this code? why shouldnt I just put the DoSomething2() outside TransactionScope4 , in TransactionScope3?
B. After this: TransactionScope4.Complete(), TransactionScope3 is Complete too becoude its the same TransactionScope, right?
C. In WCF, when I use TransactionScope in client and call some service s methods in it, each method use the TransactionScope that I created in the client or Creat new one? Why should it creat new one? In case the method creat new one, is that why the attribute: TransactionAutoComplete exsist?
using (TransactionScope TransactionScope3 = new TransactionScope())
{
Service1.DoSomething1();
using (TransactionScope TransactionScope4 = new TransactionScope(TransactionScopeOption.Required))
{
Service1.DoSomething2();
TransactionScope4.Complete();
}
TransactionScope3.Complete();
}