9using System.Collections.Generic;
23 private const string _localContextName =
"Csla.LocalContext";
24 private const string _clientContextName =
"Csla.ClientContext";
25 private const string _globalContextName =
"Csla.GlobalContext";
27 private IServiceProvider _defaultServiceProvider =
null;
36 get {
return HttpContext.Current !=
null; }
42 public System.Security.Principal.IPrincipal
GetUser()
44 var result = HttpContext.Current.User;
47 result =
new System.Security.Claims.ClaimsPrincipal();
57 public void SetUser(System.Security.Principal.IPrincipal principal)
59 HttpContext.Current.User = principal;
76 HttpContext.Current.Items[_localContextName] = localContext;
93 HttpContext.Current.Items[_clientContextName] = clientContext;
110 HttpContext.Current.Items[_globalContextName] = globalContext;
118 return _defaultServiceProvider;
127 _defaultServiceProvider = serviceProvider;
Dictionary type that is serializable with the SerializationFormatterFactory.GetFormatter().
Application context manager that uses HttpContext to store context values.
void SetUser(System.Security.Principal.IPrincipal principal)
Sets the current principal.
System.Security.Principal.IPrincipal GetUser()
Gets the current principal.
void SetGlobalContext(ContextDictionary globalContext)
Sets the global context.
void SetDefaultServiceProvider(IServiceProvider serviceProvider)
Sets the default IServiceProvider
ContextDictionary GetGlobalContext()
Gets the global context.
bool IsValid
Gets a value indicating whether this context manager is valid for use in the current environment.
void SetLocalContext(ContextDictionary localContext)
Sets the local context.
IServiceProvider GetServiceProvider()
Gets the service provider for current scope
ContextDictionary GetClientContext()
Gets the client context.
ContextDictionary GetLocalContext()
Gets the local context.
void SetServiceProvider(IServiceProvider scope)
Sets the service provider for current scope
IServiceProvider GetDefaultServiceProvider()
Gets the default IServiceProvider
void SetClientContext(ContextDictionary clientContext)
Sets the client context.
Defines the interface for an application context manager type.