Class ContextModeScope
A helper object that can be used when setting ContextMode for current Microsoft.AspNetCore.Http.HttpContext.
Inheritance
Implements
Namespace: EPiServer.Web
Assembly: EPiServer.Cms.AspNetCore.dll
Version: 12.0.3Syntax
public class ContextModeScope : Object, 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(HttpContext, 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(HttpContext requestContext, ContextMode contextMode)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.AspNetCore.Http.HttpContext | requestContext | The Microsoft.AspNetCore.Http.HttpContext 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 |
|