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
- XhtmlBasicControlAdapter.cs
- ImageSourceValueSerializer.cs
- AddingNewEventArgs.cs
- EncryptedXml.cs
- DoWorkEventArgs.cs
- DataGridViewRowsAddedEventArgs.cs
- QueueProcessor.cs
- SqlDataSourceSummaryPanel.cs
- XmlIlTypeHelper.cs
- ContainerControl.cs
- XmlAnyAttributeAttribute.cs
- CompModSwitches.cs
- LinkLabel.cs
- FixedSOMPageConstructor.cs
- ExtractorMetadata.cs
- Facet.cs
- ITextView.cs
- MenuItemCollection.cs
- AxisAngleRotation3D.cs
- VersionPair.cs
- QueryAccessibilityHelpEvent.cs
- BindingExpressionBase.cs
- FixedSOMLineCollection.cs
- LongValidator.cs
- SchemaManager.cs
- BinaryObjectWriter.cs
- Tokenizer.cs
- Axis.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- DeviceContext2.cs
- UseManagedPresentationBindingElementImporter.cs
- DocumentProperties.cs
- ToolStripSplitButton.cs
- SoapExtension.cs
- HostUtils.cs
- EnglishPluralizationService.cs
- Point3D.cs
- DSACryptoServiceProvider.cs
- FilteredXmlReader.cs
- SqlProviderManifest.cs
- AssemblySettingAttributes.cs
- SeekableReadStream.cs
- XmlSchemaSimpleType.cs
- Preprocessor.cs
- _StreamFramer.cs
- RemotingAttributes.cs
- PrivilegeNotHeldException.cs
- TripleDES.cs
- ObjectDataSourceMethodEventArgs.cs
- WindowsGraphics.cs
- ButtonFieldBase.cs
- EdmTypeAttribute.cs
- JavaScriptString.cs
- MembershipSection.cs
- SafeNativeMethods.cs
- WebBaseEventKeyComparer.cs
- SelectedGridItemChangedEvent.cs
- MailDefinition.cs
- ToolStripSplitButton.cs
- HostingEnvironmentWrapper.cs
- NamespaceDecl.cs
- ConfigXmlWhitespace.cs
- TextDecoration.cs
- StreamProxy.cs
- TypedDataSourceCodeGenerator.cs
- Resources.Designer.cs
- ByteAnimationUsingKeyFrames.cs
- Vector3DCollectionConverter.cs
- DummyDataSource.cs
- ButtonField.cs
- MachineKeyValidationConverter.cs
- PriorityItem.cs
- WebPartMenu.cs
- MessageProtectionOrder.cs
- DbConnectionPoolGroup.cs
- EllipticalNodeOperations.cs
- Rectangle.cs
- ObjectHandle.cs
- dataobject.cs
- RelationshipSet.cs
- SchemaElement.cs
- CompilerTypeWithParams.cs
- PageThemeParser.cs
- CustomBindingElementCollection.cs
- MouseGestureValueSerializer.cs
- IDQuery.cs
- Point3DCollectionConverter.cs
- ProcessHostFactoryHelper.cs
- DataDocumentXPathNavigator.cs
- RelOps.cs
- RegexRunnerFactory.cs
- MbpInfo.cs
- WorkerRequest.cs
- HostedElements.cs
- DataRelationCollection.cs
- PageThemeCodeDomTreeGenerator.cs
- CustomWebEventKey.cs
- ReflectionServiceProvider.cs
- FontStretches.cs
- PageClientProxyGenerator.cs