Enlistment.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Bridge / Enlistment.cs / 1 / Enlistment.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
using System;
 
namespace Microsoft.Transactions.Bridge
{ 
    [Flags] 
    enum Notifications
    { 
        Phase0            = 0x000001, // Enlistment wants/will do phase-0 notifications
        TwoPhaseCommit    = 0x000002, // Enlistment wants/will do two phase commit notifications
        Outcome           = 0x000004, // Enlistment wants/will do outcome notifications
 
        AllProtocols      = (Notifications.Phase0 |
                             Notifications.TwoPhaseCommit | 
                             Notifications.Outcome), 

        InDoubt           = 0x000008, // Enlistment can handle in-doubt status reports 
        Volatile          = 0x000010, // Enlistment should not be recovered

        All               = (Notifications.AllProtocols |
                             Notifications.InDoubt | 
                             Notifications.Volatile)
    } 
 
    /// 
    /// The Enlistment type defines the enlistment, which is the mapping of 
    /// the transaction from provider to PPL to TM.
    /// 
    sealed class Enlistment
    { 
         public Enlistment( )
        { 
            this.localTransactionId = Guid.Empty; 
            this.enlistmentId = Guid.NewGuid( );
            this.remoteTransactionId = null; 
            this.recoveryData = new byte[0];
            this.transactionManagerContext = null;
            this.protocolProviderContext = null;
            this.notificationMask = Notifications.AllProtocols; 
        }
 
        public Enlistment( Guid enlistmentId ) 
        {
            this.localTransactionId = Guid.Empty; 
            this.enlistmentId = enlistmentId;
            this.remoteTransactionId = null;
            this.recoveryData = new byte[0];
            this.transactionManagerContext = null; 
            this.protocolProviderContext = null;
            this.notificationMask = Notifications.AllProtocols; 
       } 

        public Guid EnlistmentId 
        {
            get{ return enlistmentId; }
        }
 
        public Guid LocalTransactionId
        { 
            get{ return localTransactionId; } 
            set{ localTransactionId = value; }
        } 

        public string RemoteTransactionId
        {
            get{ return remoteTransactionId; } 
            set{ remoteTransactionId = value; }
        } 
 
        public object TransactionManagerContext
        { 
            get{ return transactionManagerContext; }
            set{ transactionManagerContext = value; }
        }
 
        public object ProtocolProviderContext
        { 
            get{ return protocolProviderContext; } 
            set{ protocolProviderContext = value; }
        } 

        public byte[] GetRecoveryData()
        {
            return (byte[])recoveryData.Clone(); 
        }
 
        public void SetRecoveryData(byte[] data) 
        {
            if (data != null) 
                recoveryData = (byte[])data.Clone();
            else
                recoveryData = new byte[0];
        } 

        public Notifications NotificationMask 
        { 
            get { return notificationMask; }
            set { notificationMask = value; } 
        }

        override public string ToString( )
        { 
            return this.GetType( ).ToString( ) +
                " enlistment ID = " + enlistmentId.ToString( "B", null ) + 
                " transaction ID = " + localTransactionId.ToString( "B", null ); 
        }
 
        public EnlistmentOptions EnlistmentOptions
        {
            get{ return this.enlistmentOptions; }
            set{ this.enlistmentOptions = value; } 
        }
 
        // 
        //
        // 
        private Guid localTransactionId;
        private Guid enlistmentId;
        private string remoteTransactionId;
        private byte[] recoveryData; 
        private Notifications notificationMask;
        private EnlistmentOptions enlistmentOptions; 
 
        private object transactionManagerContext;
        private object protocolProviderContext; 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK