TransactionInformation.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / tx / System / Transactions / TransactionInformation.cs / 1305376 / TransactionInformation.cs

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

namespace System.Transactions 
{ 
    using System;
    using System.Transactions.Diagnostics; 

    public class TransactionInformation
    {
        private InternalTransaction internalTransaction; 

        internal TransactionInformation( InternalTransaction internalTransaction ) 
        { 
            this.internalTransaction = internalTransaction;
        } 


        public string LocalIdentifier
        { 
            get
            { 
                if ( DiagnosticTrace.Verbose ) 
                {
                    MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceLtm ), 
                        "TransactionInformation.get_LocalIdentifier"
                        );
                }
 
                try
                { 
                    return this.internalTransaction.TransactionTraceId.TransactionIdentifier; 
                }
                finally 
                {
                    if ( DiagnosticTrace.Verbose )
                    {
                        MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceLtm ), 
                            "TransactionInformation.get_LocalIdentifier"
                            ); 
                    } 
                }
            } 
        }


        public Guid DistributedIdentifier 
        {
            get 
            { 
                if ( DiagnosticTrace.Verbose )
                { 
                    MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceLtm ),
                        "TransactionInformation.get_DistributedIdentifier"
                        );
                } 

                try 
                { 
                    // syncronize to avoid potential ---- between accessing the DistributerIdentifier
                    // and getting the transaction information entry populated... 

                    lock(this.internalTransaction)
                    {
                        return this.internalTransaction.State.get_Identifier( this.internalTransaction ); 
                    }
                } 
                finally 
                {
                    if ( DiagnosticTrace.Verbose ) 
                    {
                        MethodExitedTraceRecord.Trace( SR.GetString( SR.TraceSourceLtm ),
                            "TransactionInformation.get_DistributedIdentifier"
                            ); 
                    }
                } 
 
            }
        } 


        public DateTime CreationTime
        { 
            get
            { 
                return new DateTime( this.internalTransaction.CreationTime ); 
            }
        } 


        public TransactionStatus Status
        { 
            get
            { 
                if ( DiagnosticTrace.Verbose ) 
                {
                    MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceLtm ), 
                        "TransactionInformation.get_Status"
                        );
                }
 
                try
                { 
                    return this.internalTransaction.State.get_Status( this.internalTransaction ); 
                }
                finally 
                {
                    if ( DiagnosticTrace.Verbose )
                    {
                        MethodExitedTraceRecord.Trace( SR.GetString( SR.TraceSourceLtm ), 
                            "TransactionInformation.get_Status"
                            ); 
                    } 
                }
            } 
        }
    }
}
 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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