Class ContextModeScope

A helper object that can be used when setting ContextMode for current System.Web.Routing.RequestContext.

Inheritance
System.Object
ContextModeScope
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class ContextModeScope : IDisposable
Remarks

This class implements System.IDisposable and should be used inside a using statement. When disposed it will set ContextMode back to its previous value.

Constructors

ContextModeScope(RequestContext, ContextMode)

Constructor that creates a new instance of ContextModeScope which will set ContextMode to specified value for the requestContext during the scope of this instance.

Declaration
public ContextModeScope(RequestContext requestContext, ContextMode contextMode)
Parameters
Type Name Description
System.Web.Routing.RequestContext requestContext

The System.Web.Routing.RequestContext for which ContextMode will be set.

ContextMode contextMode

The mode to set.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

Dispose(Boolean)

Resets the ContextMode to previous value when disposed.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

true to reset ContextMode to previous state.

Implements

System.IDisposable

Extension Methods