OperationContextScope Class
Creates a block within which an OperationContext object is in scope.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The OperationContextScope type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | OperationContextScope(IContextChannel) | Initializes a new instance of the OperationContextScope class that uses the specified IContextChannel to create a new OperationContext for the scope. |
![]() ![]() | OperationContextScope(OperationContext) | Initializes a new instance of the OperationContextScope class to create a scope for the specified OperationContext object. |
| Name | Description | |
|---|---|---|
![]() ![]() | Dispose | Restores the original OperationContext to the active context and recycles the OperationContextScope object. |
![]() ![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Use the OperationContextScope class to create a scope for a specific OperationContext object or a scope for a new OperationContext object using a specified IContextChannel object. An OperationContextScope can be used in a service or client application.
Once the OperationContextScope object has established the current operation context, you can use the OperationContext to:
Access and modify incoming and outgoing message headers and other properties.
Access the runtime, including dispatchers, the host, channel, and extensions.
Access other types of contexts, such as security, instance, and request contexts.
Access the channel associated with the OperationContext object or (if the channel implements System.ServiceModel.Channels::ISession) the associated channel's session identifier.
When an OperationContextScope is created, the current OperationContext is stored and the new OperationContext becomes the one returned by the Current property. When the OperationContextScope is disposed, the original OperationContext is restored.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

