English 中文(简体)
C# / WCF TransactionScopeOption.Required
原标题:C# / WCF TransactionScopeOption.Required

我对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();
            }
最佳回答

http://msdn.microsoft.com/en-us/library/system.transactions.transactioncop.complete.aspx”rel=“nofollow”>。

如果交易发生,资源管理人之间的承诺实际工作在最后使用声明<>>>。 范围标出的交易。 如果它不制造交易,只要交易标的所有人要求交易,就发生。

因此,为了回答问题B,你没有要求TransactionScope4.Complete(不进行交易,因为交易是: 范围审查本将重新使用<代码>TransactionScope3。

为了回答C,如果你表示需要一笔交易来提供周转基金服务,那么如果在客户上建立了现有的交易范围,那么世界投资基金不会开始新的交易(而且由于上述原因,如果服务要求终止,它将不承付)。 然而,如果客户没有公开的往来业务范围,那么世界投资基金就会开始新的交易,并在服务呼吁结束时自动投入或退缩。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签