Activity.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 / SMDiagnostics / System / ServiceModel / Diagnostics / Activity.cs / 1 / Activity.cs

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

namespace System.ServiceModel.Diagnostics 
{
    class Activity : IDisposable 
    { 
        protected Guid parentId;
        Guid currentId; 
        bool mustDispose = false;

        protected Activity(Guid activityId, Guid parentId)
        { 
            this.currentId = activityId;
            this.parentId = parentId; 
            this.mustDispose = true; 
            DiagnosticTrace.ActivityId = this.currentId;
        } 

        internal static Activity CreateActivity(Guid activityId)
        {
            Activity retval = null; 
            if (activityId != Guid.Empty)
            { 
                Guid currentActivityId = DiagnosticTrace.ActivityId; 
                if (activityId != currentActivityId)
                { 
                    retval = new Activity(activityId, currentActivityId);
                }
            }
            return retval; 
        }
 
        public virtual void Dispose() 
        {
            if (this.mustDispose) 
            {
                this.mustDispose = false;
                DiagnosticTrace.ActivityId = this.parentId;
            } 
            GC.SuppressFinalize(this);
        } 
 
        protected Guid Id
        { 
            get { return this.currentId; }
        }
    }
} 

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