Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / Diagnostics / CorrelationManager.cs / 1 / CorrelationManager.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Threading;
using System.Runtime.Remoting.Messaging;
namespace System.Diagnostics {
public class CorrelationManager {
private const string transactionSlotName = "System.Diagnostics.Trace.CorrelationManagerSlot";
private const string activityIdSlotName = "E2ETrace.ActivityID";
internal CorrelationManager() { }
public Guid ActivityId {
get {
Object id = CallContext.LogicalGetData(activityIdSlotName);
if (id != null)
return (Guid) id;
else
return Guid.Empty;
}
set {
CallContext.LogicalSetData(activityIdSlotName, value);
}
}
public Stack LogicalOperationStack {
get {
return GetLogicalOperationStack();
}
}
public void StartLogicalOperation(object operationId) {
if (operationId == null)
throw new ArgumentNullException("operationId");
Stack idStack = GetLogicalOperationStack();
idStack.Push(operationId);
}
public void StartLogicalOperation() {
StartLogicalOperation(Guid.NewGuid());
}
public void StopLogicalOperation() {
Stack idStack = GetLogicalOperationStack();
idStack.Pop();
}
private Stack GetLogicalOperationStack() {
Stack idStack = CallContext.LogicalGetData(transactionSlotName) as Stack;
if (idStack == null) {
idStack = new Stack();
CallContext.LogicalSetData(transactionSlotName, idStack);
}
return idStack;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Threading;
using System.Runtime.Remoting.Messaging;
namespace System.Diagnostics {
public class CorrelationManager {
private const string transactionSlotName = "System.Diagnostics.Trace.CorrelationManagerSlot";
private const string activityIdSlotName = "E2ETrace.ActivityID";
internal CorrelationManager() { }
public Guid ActivityId {
get {
Object id = CallContext.LogicalGetData(activityIdSlotName);
if (id != null)
return (Guid) id;
else
return Guid.Empty;
}
set {
CallContext.LogicalSetData(activityIdSlotName, value);
}
}
public Stack LogicalOperationStack {
get {
return GetLogicalOperationStack();
}
}
public void StartLogicalOperation(object operationId) {
if (operationId == null)
throw new ArgumentNullException("operationId");
Stack idStack = GetLogicalOperationStack();
idStack.Push(operationId);
}
public void StartLogicalOperation() {
StartLogicalOperation(Guid.NewGuid());
}
public void StopLogicalOperation() {
Stack idStack = GetLogicalOperationStack();
idStack.Pop();
}
private Stack GetLogicalOperationStack() {
Stack idStack = CallContext.LogicalGetData(transactionSlotName) as Stack;
if (idStack == null) {
idStack = new Stack();
CallContext.LogicalSetData(transactionSlotName, idStack);
}
return idStack;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScrollBar.cs
- DataContractSerializerElement.cs
- httpapplicationstate.cs
- shaperfactory.cs
- WinCategoryAttribute.cs
- ConfigsHelper.cs
- IdentityNotMappedException.cs
- SafeNativeMethods.cs
- ContractAdapter.cs
- DesignerActionService.cs
- UxThemeWrapper.cs
- HexParser.cs
- ValidationEventArgs.cs
- TemplateContentLoader.cs
- MaterialGroup.cs
- Hash.cs
- IconBitmapDecoder.cs
- DomainConstraint.cs
- CTreeGenerator.cs
- InteropBitmapSource.cs
- SiteMapPath.cs
- unsafeIndexingFilterStream.cs
- ConditionalAttribute.cs
- LinkLabel.cs
- listitem.cs
- ScrollBar.cs
- FileResponseElement.cs
- BulletDecorator.cs
- SmiEventSink.cs
- SqlWriter.cs
- CompilerCollection.cs
- LockCookie.cs
- InlineUIContainer.cs
- OleDbRowUpdatedEvent.cs
- ToolStripSettings.cs
- QilLoop.cs
- ProjectionCamera.cs
- AdRotator.cs
- ItemsControlAutomationPeer.cs
- SqlDataSourceStatusEventArgs.cs
- RtfControls.cs
- PrimitiveType.cs
- XmlUnspecifiedAttribute.cs
- Invariant.cs
- BaseCodePageEncoding.cs
- ToolStripDropDownItemDesigner.cs
- TokenBasedSetEnumerator.cs
- BamlRecordHelper.cs
- ProjectionQueryOptionExpression.cs
- BuildResult.cs
- XmlDataSource.cs
- UnsafeMethods.cs
- FacetValueContainer.cs
- InheritanceContextChangedEventManager.cs
- DocumentSchemaValidator.cs
- IconConverter.cs
- PingReply.cs
- MetaForeignKeyColumn.cs
- TextMetrics.cs
- StreamGeometry.cs
- HitTestResult.cs
- RuntimeHandles.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- InheritanceUI.cs
- SerialPinChanges.cs
- ToolStripDropDownMenu.cs
- BaseProcessor.cs
- HashRepartitionEnumerator.cs
- MutexSecurity.cs
- ZipFileInfo.cs
- DataObjectMethodAttribute.cs
- ExpressionList.cs
- HttpSessionStateWrapper.cs
- JournalNavigationScope.cs
- StateMachine.cs
- DeferredRunTextReference.cs
- ACE.cs
- TraceProvider.cs
- DataGridViewCellStyle.cs
- printdlgexmarshaler.cs
- LinkLabelLinkClickedEvent.cs
- TreeSet.cs
- OutputCacheModule.cs
- PriorityQueue.cs
- LayoutManager.cs
- UriParserTemplates.cs
- TabRenderer.cs
- RegistryExceptionHelper.cs
- TimeManager.cs
- SequentialWorkflowHeaderFooter.cs
- SplineQuaternionKeyFrame.cs
- AutoFocusStyle.xaml.cs
- FormatSettings.cs
- ToolStripSplitStackLayout.cs
- _DigestClient.cs
- HuffCodec.cs
- RequestCacheEntry.cs
- SoapFormatterSinks.cs
- RectAnimationBase.cs
- COM2EnumConverter.cs