Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / OperationContextScope.cs / 1 / OperationContextScope.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel { using System; using System.ServiceModel.Channels; using System.Threading; public sealed class OperationContextScope : IDisposable { [ThreadStatic] static OperationContextScope currentScope; OperationContext currentContext; bool disposed; readonly OperationContext originalContext = OperationContext.Current; readonly OperationContextScope originalScope = OperationContextScope.currentScope; readonly Thread thread = Thread.CurrentThread; public OperationContextScope(IContextChannel channel) { this.PushContext(new OperationContext(channel)); } public OperationContextScope(OperationContext context) { this.PushContext(context); } public void Dispose() { if (!this.disposed) { this.disposed = true; this.PopContext(); } } void PushContext(OperationContext context) { this.currentContext = context; OperationContextScope.currentScope = this; OperationContext.Current = this.currentContext; } void PopContext() { if (this.thread != Thread.CurrentThread) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInvalidContextScopeThread0))); if (OperationContextScope.currentScope != this) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInterleavedContextScopes0))); if (OperationContext.Current != this.currentContext) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxContextModifiedInsideScope0))); OperationContextScope.currentScope = this.originalScope; OperationContext.Current = this.originalContext; if (this.currentContext != null) this.currentContext.SetClientReply(null, false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WindowsGraphicsWrapper.cs
- BamlResourceSerializer.cs
- WebPartManager.cs
- ZipIOCentralDirectoryBlock.cs
- PriorityRange.cs
- XmlDataSourceNodeDescriptor.cs
- DelegateBodyWriter.cs
- IISMapPath.cs
- BaseResourcesBuildProvider.cs
- ConfigurationManagerHelper.cs
- SqlDataAdapter.cs
- Menu.cs
- DiagnosticTraceSource.cs
- LicenseException.cs
- TaskScheduler.cs
- ListDataHelper.cs
- GPPOINTF.cs
- SecureUICommand.cs
- LicFileLicenseProvider.cs
- WizardStepBase.cs
- DependencyProperty.cs
- OdbcReferenceCollection.cs
- SectionUpdates.cs
- OutputBuffer.cs
- JavascriptCallbackResponseProperty.cs
- SettingsPropertyValue.cs
- TaiwanCalendar.cs
- CryptoApi.cs
- Light.cs
- CfgParser.cs
- CustomCategoryAttribute.cs
- UnsafeNativeMethods.cs
- ListSortDescription.cs
- WinEventQueueItem.cs
- ConfigurationProperty.cs
- Wildcard.cs
- ToolBarButton.cs
- Selector.cs
- FilterableAttribute.cs
- MenuBase.cs
- DBSqlParser.cs
- HebrewNumber.cs
- ConnectionsZoneDesigner.cs
- DbProviderFactory.cs
- HtmlButton.cs
- WSSecurityPolicy11.cs
- AnyAllSearchOperator.cs
- WizardForm.cs
- InteropExecutor.cs
- CodeGenerator.cs
- WindowsSecurityTokenAuthenticator.cs
- PowerModeChangedEventArgs.cs
- serverconfig.cs
- TableLayoutStyleCollection.cs
- Rectangle.cs
- CryptoHelper.cs
- WmlPanelAdapter.cs
- WindowsClaimSet.cs
- SQLInt32.cs
- CalloutQueueItem.cs
- EventHandlerList.cs
- AutomationPropertyInfo.cs
- X509Chain.cs
- PageCache.cs
- namescope.cs
- safemediahandle.cs
- ChangeTracker.cs
- ResourceManagerWrapper.cs
- NamespaceInfo.cs
- BindingGroup.cs
- ScrollItemPattern.cs
- CustomAssemblyResolver.cs
- WaitingCursor.cs
- ExpressionNormalizer.cs
- SystemResourceHost.cs
- DataMemberConverter.cs
- EditBehavior.cs
- StaticResourceExtension.cs
- Transaction.cs
- QuinticEase.cs
- ExceptionUtil.cs
- ChangeTracker.cs
- StructuralObject.cs
- ServiceHttpHandlerFactory.cs
- RadioButtonRenderer.cs
- Semaphore.cs
- Constant.cs
- SqlNodeAnnotations.cs
- HttpRequestCacheValidator.cs
- Parser.cs
- QueryPageSettingsEventArgs.cs
- RewritingSimplifier.cs
- XomlCompilerError.cs
- HebrewNumber.cs
- RtType.cs
- ToolStripItemEventArgs.cs
- coordinator.cs
- GregorianCalendarHelper.cs
- PenContext.cs
- DataRowExtensions.cs