C# Class DryIoc.Web.HttpContextScopeContext

Stores current scope in HttpContext.Items.
Stateless context, so could be created multiple times and used from different places without side-effects.
Inheritance: IScopeContext, IDisposable
显示文件 Open project: mobsoftware/mobsocial Class Usage Examples

Public Properties

Property Type Description
GetContextItems Func
ScopeContextName string

Public Methods

Method Description
Dispose ( ) : void

Nothing to dispose.

GetCurrentOrDefault ( ) : IScope

Returns current ambient scope stored in item storage.

HttpContextScopeContext ( Func getContextItems = null ) : System

Creates the context optionally with arbitrary/test items storage.

SetCurrent ( SetCurrentScopeHandler setCurrentScope ) : IScope

Sets the new scope as current using existing current as input.

Method Details

Dispose() public method

Nothing to dispose.
public Dispose ( ) : void
return void

GetCurrentOrDefault() public method

Returns current ambient scope stored in item storage.
public GetCurrentOrDefault ( ) : IScope
return IScope

HttpContextScopeContext() public method

Creates the context optionally with arbitrary/test items storage.
public HttpContextScopeContext ( Func getContextItems = null ) : System
getContextItems Func (optional) Arbitrary/test items storage.
return System

SetCurrent() public method

Sets the new scope as current using existing current as input.
public SetCurrent ( SetCurrentScopeHandler setCurrentScope ) : IScope
setCurrentScope SetCurrentScopeHandler Delegate to get new scope.
return IScope

Property Details

GetContextItems public_oe static_oe property

Provides default context items dictionary using HttpContext.Current. Could be overridden with any key-value dictionary where HttpContext is not available, e.g. in tests.
public static Func GetContextItems
return Func

ScopeContextName public_oe static_oe property

Fixed root scope name for the context.
public static string ScopeContextName
return string