SPServiceContextScope class

Creates a block within which an SPServiceContext object is in scope.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.SPServiceContextScope

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public NotInheritable Class SPServiceContextScope _
    Implements IDisposable
'Usage
Dim instance As SPServiceContextScope
public sealed class SPServiceContextScope : IDisposable

Remarks

The block is limited to the thread on which the object is created.

The object must be created and disposed on the same thread. Multiple objects of this type can be created on a thread, but they must be disposed in a LIFO manner. Specifically, if scopes are created in order (1,2,3,4,5), they must be disposed in the opposite order (5,4,3,2,1). Failure to do so causes an exception to be thrown.

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

SPServiceContextScope members

Microsoft.SharePoint namespace