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
- XmlAutoDetectWriter.cs
- DataRelationPropertyDescriptor.cs
- XmlSchemaDocumentation.cs
- FrameDimension.cs
- CatalogPartChrome.cs
- CodeCommentStatementCollection.cs
- OrderingQueryOperator.cs
- RemotingException.cs
- RowsCopiedEventArgs.cs
- LongSumAggregationOperator.cs
- XmlSchemaParticle.cs
- ParseChildrenAsPropertiesAttribute.cs
- LabelEditEvent.cs
- SQLBinaryStorage.cs
- FixedSOMFixedBlock.cs
- ConfigurationManager.cs
- ContentWrapperAttribute.cs
- NetworkCredential.cs
- ListChunk.cs
- StoryFragments.cs
- MasterPageCodeDomTreeGenerator.cs
- KeyboardEventArgs.cs
- PropertyDescriptorGridEntry.cs
- DetailsViewModeEventArgs.cs
- XmlCodeExporter.cs
- ContentTextAutomationPeer.cs
- UICuesEvent.cs
- HtmlElementCollection.cs
- PKCS1MaskGenerationMethod.cs
- UnsafeNativeMethodsTablet.cs
- EventBuilder.cs
- StringExpressionSet.cs
- GlyphRun.cs
- ExtensionFile.cs
- XmlSchemaAnyAttribute.cs
- TrustLevel.cs
- FixedSOMTextRun.cs
- Version.cs
- UrlPath.cs
- TimeManager.cs
- KeyValuePair.cs
- DataGridDetailsPresenter.cs
- SynchronizedInputAdaptor.cs
- PeerNeighborManager.cs
- safex509handles.cs
- AppModelKnownContentFactory.cs
- HtmlTableRowCollection.cs
- SystemIcmpV4Statistics.cs
- XmlNavigatorStack.cs
- CompressEmulationStream.cs
- StrokeRenderer.cs
- SmuggledIUnknown.cs
- ItemContainerProviderWrapper.cs
- DataTransferEventArgs.cs
- XmlSchemaValidator.cs
- DetailsViewDeletedEventArgs.cs
- FamilyMap.cs
- TemplateInstanceAttribute.cs
- MessageSmuggler.cs
- DataErrorValidationRule.cs
- MachineKeySection.cs
- Quaternion.cs
- ArrayWithOffset.cs
- NamespaceDecl.cs
- CreateRefExpr.cs
- ZipIOBlockManager.cs
- Popup.cs
- Configuration.cs
- TextEditorSelection.cs
- ActivityStatusChangeEventArgs.cs
- Int32AnimationUsingKeyFrames.cs
- ConfigXmlReader.cs
- XmlSchemaSimpleTypeRestriction.cs
- TiffBitmapDecoder.cs
- FocusWithinProperty.cs
- DynamicPropertyReader.cs
- DataGridViewCellFormattingEventArgs.cs
- ImageIndexEditor.cs
- XamlVector3DCollectionSerializer.cs
- UInt16.cs
- TemplateBamlRecordReader.cs
- loginstatus.cs
- IntSecurity.cs
- DurableServiceAttribute.cs
- TemplateControl.cs
- PersonalizableTypeEntry.cs
- CorrelationManager.cs
- ProfileSection.cs
- SoapConverter.cs
- NextPreviousPagerField.cs
- Size3D.cs
- XmlArrayAttribute.cs
- SafeNativeMethodsMilCoreApi.cs
- RangeBase.cs
- ReadOnlyTernaryTree.cs
- DataGridParentRows.cs
- COM2EnumConverter.cs
- GeometryCombineModeValidation.cs
- Predicate.cs
- DateTimeEditor.cs