Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / CorrelationManager.cs / 1305376 / 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
- _CookieModule.cs
- SupportedAddressingMode.cs
- MetafileHeaderEmf.cs
- DataService.cs
- TrackPointCollection.cs
- XmlSchemaDocumentation.cs
- LookupBindingPropertiesAttribute.cs
- FileSystemInfo.cs
- ComplexPropertyEntry.cs
- SoapExtensionStream.cs
- EntityViewGenerationAttribute.cs
- OrderingInfo.cs
- ConfigurationValues.cs
- OdbcError.cs
- CounterSampleCalculator.cs
- DataGridViewColumnCollection.cs
- ReadOnlyAttribute.cs
- Label.cs
- ColumnResult.cs
- MatrixAnimationUsingKeyFrames.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- InputDevice.cs
- UnsafeNativeMethodsTablet.cs
- SoapEnvelopeProcessingElement.cs
- NumberSubstitution.cs
- XmlIterators.cs
- OAVariantLib.cs
- DataColumnMappingCollection.cs
- DerivedKeySecurityToken.cs
- FragmentNavigationEventArgs.cs
- JoinCqlBlock.cs
- KnownBoxes.cs
- SettingsPropertyIsReadOnlyException.cs
- RootBrowserWindow.cs
- FlowDocumentScrollViewer.cs
- XmlSerializerAssemblyAttribute.cs
- Vector3DCollectionConverter.cs
- NonNullItemCollection.cs
- BuildProviderCollection.cs
- ArrayConverter.cs
- TouchPoint.cs
- SchemaElementLookUpTable.cs
- SmtpCommands.cs
- UIElement3D.cs
- DbMetaDataFactory.cs
- SspiSafeHandles.cs
- WebCategoryAttribute.cs
- BaseInfoTable.cs
- BulletChrome.cs
- Fx.cs
- PenThreadWorker.cs
- Transform.cs
- FixedPosition.cs
- XmlILAnnotation.cs
- Ray3DHitTestResult.cs
- TraceListeners.cs
- AccessorTable.cs
- ConfigurationManager.cs
- MessageQueuePermissionAttribute.cs
- ContentIterators.cs
- TrackingLocation.cs
- SimpleLine.cs
- ImageBrush.cs
- ByteAnimation.cs
- VariableReference.cs
- TreeNodeCollectionEditor.cs
- DispatcherExceptionEventArgs.cs
- Semaphore.cs
- DBSqlParserColumnCollection.cs
- Base64Stream.cs
- documentsequencetextpointer.cs
- PropertyPathWorker.cs
- ReaderOutput.cs
- CalloutQueueItem.cs
- ListBoxItemAutomationPeer.cs
- isolationinterop.cs
- OutOfMemoryException.cs
- StaticFileHandler.cs
- ClientRoleProvider.cs
- ImageAnimator.cs
- StoreItemCollection.Loader.cs
- SystemIcons.cs
- ObjectTypeMapping.cs
- HttpDigestClientCredential.cs
- ElapsedEventArgs.cs
- CLRBindingWorker.cs
- DesignerActionGlyph.cs
- UpdatePanelTriggerCollection.cs
- SyndicationElementExtension.cs
- _NegotiateClient.cs
- ContentPropertyAttribute.cs
- UIElement.cs
- CodeGen.cs
- CollectionDataContract.cs
- NotCondition.cs
- ToolStripItemRenderEventArgs.cs
- ModelPropertyCollectionImpl.cs
- PersonalizableTypeEntry.cs
- HMACMD5.cs
- HtmlInputRadioButton.cs