TwoPhaseCommit.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 / Wsat / Messaging / TwoPhaseCommit.cs / 1 / TwoPhaseCommit.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

// Define the interfaces and infrastructure needed to receive 2PC messages 

using System; 
using System.Diagnostics; 
using System.ServiceModel;
using System.ServiceModel.Channels; 
using Microsoft.Transactions.Wsat.Protocol;

using DiagnosticUtility = Microsoft.Transactions.Bridge.DiagnosticUtility;
 
namespace Microsoft.Transactions.Wsat.Messaging
{ 
    interface ITwoPhaseCommitCoordinator 
    {
        void Prepared(Message message); 
        void ReadOnly(Message message);
        void Aborted(Message message);
        void Committed(Message message);
        void Replay(Message message); 
        void Fault(Message message, MessageFault messageFault);
    } 
 
    interface ITwoPhaseCommitParticipant
    { 
        void Prepare(Message message);
        void Commit(Message message);
        void Rollback(Message message);
        void Fault(Message message, MessageFault messageFault); 
    }
 
 
//===============================================================================================================
//                              TwoPhaseTwoPhaseCommitCoordinator 
//===============================================================================================================

    class TwoPhaseCommitCoordinatorDispatcher : DatagramMessageDispatcher
    { 
        CoordinationService service;
        ITwoPhaseCommitCoordinator dispatch; 
        ProtocolVersion protocolVersion; 

        public TwoPhaseCommitCoordinatorDispatcher (CoordinationService service, ITwoPhaseCommitCoordinator dispatch) : 
            base(service.ProtocolVersion)
        {
            this.service = service;
            this.dispatch = dispatch; 
            this.protocolVersion = service.ProtocolVersion;
        } 
 
        protected override DatagramProxy CreateFaultProxy (EndpointAddress to)
        { 
            return this.service.CreateTwoPhaseCommitParticipantProxy (to, null);
        }

        public void Prepared(Message message) 
        {
            try 
            { 
                if (DebugTrace.Verbose)
                { 
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Prepared message");
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose,
                                            "Sender is {0}", 
                                            CoordinationServiceSecurity.GetSenderName(message));
                } 
 
                PreparedMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Prepared (message); 
            }
            catch (CommunicationException e)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); 
                this.OnMessageException (message, e);
            } 
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e)
            { 
                DebugTrace.Trace (
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC Prepared message: {1}",
                    e.GetType().Name, e 
                    );
 
                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong,
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e);
            } 
        }
 
        public void ReadOnly(Message message) 
        {
            try 
            {
                if (DebugTrace.Verbose)
                {
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC ReadOnly message"); 
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose, 
                                            "Sender is {0}", 
                                            CoordinationServiceSecurity.GetSenderName(message));
                } 

                ReadOnlyMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.ReadOnly (message);
            } 
            catch (CommunicationException e)
            { 
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); 
                this.OnMessageException (message, e);
            } 
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler
            catch (Exception e)
            {
                DebugTrace.Trace ( 
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC ReadOnly message: {1}", 
                    e.GetType().Name, e 
                    );
 
                // Contractually the dispatch object can only throw CommunicationException.
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...)
                // Any other exception indicates that things have gone seriously wrong, 
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e); 
            } 
        }
 
        public void Committed(Message message)
        {
            try
            { 
                if (DebugTrace.Verbose)
                { 
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Committed message"); 
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose, 
                                            "Sender is {0}",
                                            CoordinationServiceSecurity.GetSenderName(message));
                }
 
                CommittedMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Committed (message); 
            } 
            catch (CommunicationException e)
            { 
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning);
                this.OnMessageException (message, e);
            }
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e)
            { 
                DebugTrace.Trace ( 
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC Committed message: {1}", 
                    e.GetType().Name, e
                    );

                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong, 
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e); 
            }
        }

        public void Aborted(Message message) 
        {
            try 
            { 
                if (DebugTrace.Verbose)
                { 
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Aborted message");
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose,
                                            "Sender is {0}", 
                                            CoordinationServiceSecurity.GetSenderName(message));
                } 
 
                AbortedMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Aborted(message); 
            }
            catch (CommunicationException e)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); 
                this.OnMessageException (message, e);
            } 
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e)
            { 
                DebugTrace.Trace (
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC Aborted message: {1}",
                    e.GetType().Name, e 
                    );
 
                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong,
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e);
            } 
        }
 
        public void Replay(Message message) 
        {
            ProtocolVersionHelper.AssertProtocolVersion10(this.protocolVersion, typeof(TwoPhaseCommitCoordinatorDispatcher), "constr"); 
            try
            {
                if (DebugTrace.Verbose)
                { 
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Replay message");
                    if (DebugTrace.Pii) 
                        DebugTrace.TracePii(TraceLevel.Verbose, 
                                            "Sender is {0}",
                                            CoordinationServiceSecurity.GetSenderName(message)); 
                }

                ReplayMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Replay (message); 
            }
            catch (CommunicationException e) 
            { 
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning);
                this.OnMessageException (message, e); 
            }
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler
            catch (Exception e)
            { 
                DebugTrace.Trace (
                    TraceLevel.Error, 
                    "Unhandled exception {0} dispatching Replay message: {1}", 
                    e.GetType().Name, e
                    ); 

                // Contractually the dispatch object can only throw CommunicationException.
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong,
                // so we cannot be trusted to process further messages. This is a QFE-worthy event. 
                DiagnosticUtility.InvokeFinalHandler(e); 
            }
        } 

        public void WsaFault(Message message)
        {
            Fault(message); 
        }
 
        public void WscoorFault(Message message) 
        {
            Fault(message); 
        }

        public void WsatFault(Message message)
        { 
            Fault(message);
        } 
 
        void Fault (Message message)
        { 
            try
            {
                MessageFault fault = MessageFault.CreateFault (message, CoordinationBinding.MaxFaultSize);
 
                if (DebugTrace.Verbose)
                { 
                    FaultCode code = Library.GetBaseFaultCode (fault); 
                    DebugTrace.Trace(TraceLevel.Verbose,
                                     "Dispatching participant 2PC fault {0}", 
                                     code == null ? "unknown" : code.Name);

                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose, 
                                            "Sender is {0}",
                                            CoordinationServiceSecurity.GetSenderName(message)); 
                } 

                this.dispatch.Fault (message, fault); 
            }
            catch (CommunicationException e)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); 
                this.OnMessageException (message, e);
            } 
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e)
            { 
                DebugTrace.Trace (
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC fault from participant: {1}",
                    e.GetType().Name, e 
                    );
 
                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong,
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e);
            } 
        }
 
        public static IWSTwoPhaseCommitCoordinator Instance(CoordinationService service, ITwoPhaseCommitCoordinator dispatch) 
        {
            ProtocolVersionHelper.AssertProtocolVersion(service.ProtocolVersion, typeof(TwoPhaseCommitCoordinatorDispatcher), "V"); //assert valid protocol version 

            switch (service.ProtocolVersion)
            {
                case ProtocolVersion.Version10: 
                    return new TwoPhaseCommitCoordinatorDispatcher10(service, dispatch);
 
                case ProtocolVersion.Version11: 
                    return new TwoPhaseCommitCoordinatorDispatcher11(service, dispatch);
 
                default:
                    return null; // inaccessible path because we have asserted the protocol version
            }
        } 
    }
 
    [ServiceBehavior ( 
        InstanceContextMode = InstanceContextMode.Single,
        ConcurrencyMode = ConcurrencyMode.Multiple)] 
    class TwoPhaseCommitCoordinatorDispatcher10 : IWSTwoPhaseCommitCoordinator10
    {
        TwoPhaseCommitCoordinatorDispatcher twoPhaseCommitCoordinatorDispatcher;
 
        public TwoPhaseCommitCoordinatorDispatcher10(CoordinationService service, ITwoPhaseCommitCoordinator dispatch)
        { 
            ProtocolVersionHelper.AssertProtocolVersion10(service.ProtocolVersion, typeof(TwoPhaseCommitCoordinatorDispatcher10), "constr"); 
            this.twoPhaseCommitCoordinatorDispatcher = new TwoPhaseCommitCoordinatorDispatcher(service, dispatch);
        } 

        public Type ContractType
        {
            get { return typeof(IWSTwoPhaseCommitCoordinator10); } 
        }
 
        public void Prepared (Message message) 
        {
            this.twoPhaseCommitCoordinatorDispatcher.Prepared(message); 
        }

        public void ReadOnly (Message message)
        { 
            this.twoPhaseCommitCoordinatorDispatcher.ReadOnly(message);
        } 
 
        public void Aborted(Message message)
        { 
            this.twoPhaseCommitCoordinatorDispatcher.Aborted(message);
        }

        public void Committed (Message message) 
        {
            this.twoPhaseCommitCoordinatorDispatcher.Committed(message); 
        } 

        public void Replay (Message message) 
        {
            this.twoPhaseCommitCoordinatorDispatcher.Replay(message);
        }
 
        public void WsaFault(Message message)
        { 
            this.twoPhaseCommitCoordinatorDispatcher.WsaFault(message); 
        }
 
        public void WscoorFault(Message message)
        {
            this.twoPhaseCommitCoordinatorDispatcher.WscoorFault(message);
        } 

        public void WsatFault(Message message) 
        { 
            this.twoPhaseCommitCoordinatorDispatcher.WsatFault(message);
        } 
    }

    [ServiceBehavior (
        InstanceContextMode = InstanceContextMode.Single, 
        ConcurrencyMode = ConcurrencyMode.Multiple)]
    class TwoPhaseCommitCoordinatorDispatcher11 : IWSTwoPhaseCommitCoordinator11 
    { 
        TwoPhaseCommitCoordinatorDispatcher twoPhaseCommitCoordinatorDispatcher;
 
        public TwoPhaseCommitCoordinatorDispatcher11(CoordinationService service, ITwoPhaseCommitCoordinator dispatch)
        {
            ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(TwoPhaseCommitCoordinatorDispatcher11), "constr");
            this.twoPhaseCommitCoordinatorDispatcher = new TwoPhaseCommitCoordinatorDispatcher(service, dispatch); 
        }
 
        public Type ContractType 
        {
            get { return typeof(IWSTwoPhaseCommitCoordinator11); } 
        }

        public void Prepared (Message message)
        { 
            this.twoPhaseCommitCoordinatorDispatcher.Prepared(message);
        } 
 
        public void ReadOnly (Message message)
        { 
            this.twoPhaseCommitCoordinatorDispatcher.ReadOnly(message);
        }

        public void Aborted(Message message) 
        {
            this.twoPhaseCommitCoordinatorDispatcher.Aborted(message); 
        } 

        public void Committed (Message message) 
        {
            this.twoPhaseCommitCoordinatorDispatcher.Committed(message);
        }
 
        public void WsaFault(Message message)
        { 
            this.twoPhaseCommitCoordinatorDispatcher.WsaFault(message); 
        }
 
        public void WscoorFault(Message message)
        {
            this.twoPhaseCommitCoordinatorDispatcher.WscoorFault(message);
        } 

        public void WsatFault(Message message) 
        { 
            this.twoPhaseCommitCoordinatorDispatcher.WsatFault(message);
        } 
    }


//================================================================================================================ 
//                              TwoPhaseCommitParticipant
//=============================================================================================================== 
 
    class TwoPhaseCommitParticipantDispatcher : DatagramMessageDispatcher
    { 
        CoordinationService service;
        ITwoPhaseCommitParticipant dispatch;
        ProtocolVersion protocolVersion;
 
        public TwoPhaseCommitParticipantDispatcher (CoordinationService service, ITwoPhaseCommitParticipant dispatch) :
            base(service.ProtocolVersion) 
 
        {
            this.service = service; 
            this.dispatch = dispatch;
            this.protocolVersion = service.ProtocolVersion;
        }
 
        protected override DatagramProxy CreateFaultProxy (EndpointAddress to)
        { 
            return this.service.CreateTwoPhaseCommitCoordinatorProxy (to, null); 
        }
 
        public void Prepare(Message message)
        {
            try
            { 
                if (DebugTrace.Verbose)
                { 
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Prepare message"); 
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose, 
                                            "Sender is {0}",
                                            CoordinationServiceSecurity.GetSenderName(message));
                }
 
                PrepareMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Prepare (message); 
            } 
            catch (CommunicationException e)
            { 
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning);
                this.OnMessageException (message, e);
            }
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e)
            { 
                DebugTrace.Trace ( 
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching Prepare message: {1}", 
                    e.GetType().Name, e
                    );

                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong, 
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e); 
            }
        }

        public void Commit(Message message) 
        {
            try 
            { 
                if (DebugTrace.Verbose)
                { 
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Commit message");
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose,
                                            "Sender is {0}", 
                                            CoordinationServiceSecurity.GetSenderName(message));
                } 
 
                CommitMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Commit (message); 
            }
            catch (CommunicationException e)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); 
                this.OnMessageException (message, e);
            } 
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e)
            { 
                DebugTrace.Trace (
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC Commit message: {1}",
                    e.GetType().Name, e 
                    );
 
                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...) 
                // Any other exception indicates that things have gone seriously wrong,
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e);
            } 
        }
 
        public void Rollback(Message message) 
        {
            try 
            {
                if (DebugTrace.Verbose)
                {
                    DebugTrace.Trace(TraceLevel.Verbose, "Dispatching 2PC Rollback message"); 
                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose, 
                                            "Sender is {0}", 
                                            CoordinationServiceSecurity.GetSenderName(message));
                } 

                RollbackMessage.ReadFrom (message, this.protocolVersion);
                this.dispatch.Rollback (message);
            } 
            catch (CommunicationException e)
            { 
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); 
                this.OnMessageException (message, e);
            } 
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler
            catch (Exception e)
            {
                DebugTrace.Trace ( 
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC Rollback message: {1}", 
                    e.GetType().Name, e 
                    );
 
                // Contractually the dispatch object can only throw CommunicationException.
                // Our implementation is very careful to only throw this type of exception
                // (e.g. when deserializing a malformed message body or header...)
                // Any other exception indicates that things have gone seriously wrong, 
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e); 
            } 
        }
 
        public void WsaFault(Message message)
        {
            Fault(message);
        } 

        public void WscoorFault(Message message) 
        { 
            Fault(message);
        } 

        public void WsatFault(Message message)
        {
            Fault(message); 
        }
 
        void Fault(Message message) 
        {
            try 
            {
                MessageFault fault = MessageFault.CreateFault(message, CoordinationBinding.MaxFaultSize);

                if (DebugTrace.Verbose) 
                {
                    FaultCode code = Library.GetBaseFaultCode(fault); 
                    DebugTrace.Trace(TraceLevel.Verbose, 
                                     "Dispatching coordinator 2PC fault {0}",
                                     code == null ? "unknown" : code.Name); 

                    if (DebugTrace.Pii)
                        DebugTrace.TracePii(TraceLevel.Verbose,
                                            "Sender is {0}", 
                                            CoordinationServiceSecurity.GetSenderName(message));
                } 
 
                this.dispatch.Fault (message, fault);
            } 
            catch (CommunicationException e)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning);
                this.OnMessageException (message, e); 
            }
#pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler 
            catch (Exception e) 
            {
                DebugTrace.Trace ( 
                    TraceLevel.Error,
                    "Unhandled exception {0} dispatching 2PC fault from coordinator: {1}",
                    e.GetType().Name, e
                    ); 

                // Contractually the dispatch object can only throw CommunicationException. 
                // Our implementation is very careful to only throw this type of exception 
                // (e.g. when deserializing a malformed message body or header...)
                // Any other exception indicates that things have gone seriously wrong, 
                // so we cannot be trusted to process further messages. This is a QFE-worthy event.
                DiagnosticUtility.InvokeFinalHandler(e);
            }
        } 

        public static IWSTwoPhaseCommitParticipant Instance(CoordinationService service, ITwoPhaseCommitParticipant dispatch) 
        { 
            ProtocolVersionHelper.AssertProtocolVersion(service.ProtocolVersion, typeof(TwoPhaseCommitParticipantDispatcher), "V"); //assert valid protocol version
 
            switch (service.ProtocolVersion)
            {
                case ProtocolVersion.Version10:
                    return new TwoPhaseCommitParticipantDispatcher10(service, dispatch); 

                case ProtocolVersion.Version11: 
                    return new TwoPhaseCommitParticipantDispatcher11(service, dispatch); 

                default: 
                    return null; // inaccessible path because we have asserted the protocol version
            }
        }
    } 

    [ServiceBehavior ( 
        InstanceContextMode = InstanceContextMode.Single, 
        ConcurrencyMode = ConcurrencyMode.Multiple)]
    class TwoPhaseCommitParticipantDispatcher10 : IWSTwoPhaseCommitParticipant10 
    {
        TwoPhaseCommitParticipantDispatcher twoPhaseCommitParticipantDispatcher;

        public TwoPhaseCommitParticipantDispatcher10(CoordinationService service, ITwoPhaseCommitParticipant dispatch) 
        {
            ProtocolVersionHelper.AssertProtocolVersion10(service.ProtocolVersion, typeof(TwoPhaseCommitParticipantDispatcher10), "constr"); 
            this.twoPhaseCommitParticipantDispatcher = new TwoPhaseCommitParticipantDispatcher(service, dispatch); 
        }
 
        public Type ContractType
        {
            get { return typeof(IWSTwoPhaseCommitParticipant10); }
        } 

        public void Prepare (Message message) 
        { 
            this.twoPhaseCommitParticipantDispatcher.Prepare(message);
        } 

        public void Commit (Message message)
        {
            this.twoPhaseCommitParticipantDispatcher.Commit(message); 
        }
 
        public void Rollback (Message message) 
        {
            this.twoPhaseCommitParticipantDispatcher.Rollback(message); 
        }

        public void WsaFault(Message message)
        { 
            this.twoPhaseCommitParticipantDispatcher.WsaFault(message);
        } 
 
        public void WscoorFault(Message message)
        { 
            this.twoPhaseCommitParticipantDispatcher.WscoorFault(message);
        }

        public void WsatFault(Message message) 
        {
            this.twoPhaseCommitParticipantDispatcher.WsatFault(message); 
        } 
    }
 

    [ServiceBehavior (
        InstanceContextMode = InstanceContextMode.Single,
        ConcurrencyMode = ConcurrencyMode.Multiple)] 
    class TwoPhaseCommitParticipantDispatcher11 : IWSTwoPhaseCommitParticipant11
    { 
        TwoPhaseCommitParticipantDispatcher twoPhaseCommitParticipantDispatcher; 

        public TwoPhaseCommitParticipantDispatcher11(CoordinationService service, ITwoPhaseCommitParticipant dispatch) 
        {
            ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(TwoPhaseCommitParticipantDispatcher11), "constr");
            this.twoPhaseCommitParticipantDispatcher = new TwoPhaseCommitParticipantDispatcher(service, dispatch);
        } 

        public Type ContractType 
        { 
            get { return typeof(IWSTwoPhaseCommitParticipant11); }
        } 

        public void Prepare (Message message)
        {
            this.twoPhaseCommitParticipantDispatcher.Prepare(message); 
        }
 
        public void Commit (Message message) 
        {
            this.twoPhaseCommitParticipantDispatcher.Commit(message); 
        }

        public void Rollback (Message message)
        { 
            this.twoPhaseCommitParticipantDispatcher.Rollback(message);
        } 
 
        public void WsaFault(Message message)
        { 
            this.twoPhaseCommitParticipantDispatcher.WsaFault(message);
        }

        public void WscoorFault(Message message) 
        {
            this.twoPhaseCommitParticipantDispatcher.WscoorFault(message); 
        } 

        public void WsatFault(Message message) 
        {
            this.twoPhaseCommitParticipantDispatcher.WsatFault(message);
        }
    } 
}

// 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