Discussion on three System.Transactions affairs of distributed transaction [last article]

Source: Internet
Author: User
Tags rollback

In. NET 1.x, we basically implement transactions that are accessed by different databases through ado.net.. NET 2.0 to bring a new transaction programming pattern, because all transaction components or types are defined in the System.Transactions assembly Under the System.Transactions namespace, we directly call the transaction based on this as System.Transactions transaction. The System.Transactions transaction programming model allows us to explicitly (through System.Transactions.Transaction) or implicit -Type (System.Transactions.TransactionScope)-based approach to transaction programming. Let's take a look at how this new transaction is represented.

First, System.Transactions.Transaction

Under the System.Transactions transaction system, the transaction itself is represented by the type System.Transactions.Transaction type, and the following is the definition of transaction:

1: [Serializable]
2:public class transaction:idisposable, ISerializable
3: {
4:public Event Transactioncompletedeventhandler transactioncompleted;  
5:
6:public Transaction Clone ();
7:public dependenttransaction Dependentclone (dependentcloneoption Cloneoption);
8:
9:public enlistment enlistdurable (Guid resourcemanageridentifier, IEnlistmentNotification EnlistmentNoti Fication, Enlistmentoptions enlistmentoptions);
10:public Enlistment enlistdurable (Guid resourcemanageridentifier, ISinglePhaseNotification SinglePhaseNotifica tion, enlistmentoptions enlistmentoptions);
11:public bool Enlistpromotablesinglephase (ipromotablesinglephasenotification Promotablesinglephasenotificati ON);
12:public Enlistment EnlistVolatile (ienlistmentnotification enlistmentnotification, EnlistmentOptions enlistme Ntoptions);
13:public Enlistment enlistvolatile (isinglephasenotification singlephasenotificatIon, Enlistmentoptions enlistmentoptions);
:
15:public void Rollback ();
16:public void Rollback (Exception e);
:
18:void Iser Ializable. GetObjectData (SerializationInfo SerializationInfo, StreamingContext context);
:
20:public static Transaction current {get; set;}
:
22:public isolationlevel isolationlevel {get;}
23:public transactioninformation transactioninformation {get;}
:}

1, transaction is serializable

From the above definition we can see that the transaction type (in the absence of special instructions, the following transaction types Refers to the System.Transactions.Transaction) above the application of the SerializableAttribute features, and the implementation of the ISerializable interface, means that a transaction object can be serialized. This feature of transaction is significant for the implementation of WCF's entire distributed transaction, for the simple reason that the transaction can be controlled by the entire service operation, and that the propagation is based on the premise that the transaction can be serialized.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.