TransactionContextManager.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 / Protocol / TransactionContextManager.cs / 1 / TransactionContextManager.cs

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

// This file contains the enlistment type for the TransactionContext state machine 
// It isn't really an enlistment in the PPL sense, but it behaves a lot like one.
// 
// This class holds all the state associated with a TransactionContext state machine. 
// That means the actual TransactionContext (when we have one), the queue of
// active CCC w/ context requests, the right fault to send back if we fail, etc. 

using System;
using System.Collections.Generic;
using System.Diagnostics; 

using Microsoft.Transactions.Wsat.Messaging; 
using Microsoft.Transactions.Wsat.StateMachines; 

namespace Microsoft.Transactions.Wsat.Protocol 
{
    class TransactionContextManager : TransactionEnlistment
    {
        string identifier; 
        TransactionContext context;
        Fault fault; 
 
        Queue requests;
 
        public TransactionContextManager(ProtocolState state, string identifier)
            :
            base(state)
        { 
            this.identifier = identifier;
            this.requests = new Queue(); 
 
            this.stateMachine = new TransactionContextStateMachine(this);
            this.stateMachine.ChangeState(state.States.TransactionContextInitializing); 
        }

        public string Identifier
        { 
            get { return this.identifier; }
        } 
 
        public TransactionContext TransactionContext
        { 
            get { return this.context; }
            set { this.context = value; }
        }
 
        public Fault Fault
        { 
            get 
            {
                // Default to 'cannot create context' fault 
                if (this.fault == null)
                    return this.state.Faults.CannotCreateContext;

                return this.fault; 
            }
            set 
            { 
                Debug.Assert(this.fault == null && value != null, "Cannot clobber or set fault to null");
                this.fault = value; 
            }
        }

        public Queue Requests 
        {
            get { return this.requests; } 
        } 

        public override void OnStateMachineComplete() 
        {
            state.Lookup.RemoveTransactionContextManager(this);
        }
    } 
}

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