2using System.Collections.Generic;
3using System.Collections.Specialized;
5using System.Security.Claims;
6using System.Security.Principal;
17 private static HybridDictionary _myContext =
new HybridDictionary();
18 private readonly AsyncLocal<IPrincipal> _principal =
new();
20 private const string _localContextName =
"Csla.ClientContext";
21 private const string _clientContextName =
"Csla.ClientContext";
22 private const string _globalContextName =
"Csla.GlobalContext";
35 IPrincipal result = _principal.Value;
38 result =
new System.Security.Claims.ClaimsPrincipal();
46 _principal.Value = principal;
51 if (_myContext[_localContextName] ==
null)
58 _myContext[_localContextName] = localContext;
63 if (_myContext[_clientContextName] ==
null)
70 _myContext[_clientContextName] = clientContext;
75 if (_myContext[_globalContextName] ==
null)
82 _myContext[_globalContextName] = globalContext;
85 private static IServiceProvider _provider;
101 _provider = serviceProvider;
Provides consistent context information between the client and server DataPortal objects.
ExecutionLocations
Enum representing the locations code can execute.
ContextDictionary LocalContext
Returns the application-specific context data that is local to the current AppDomain.
Dictionary type that is serializable with the SerializationFormatterFactory.GetFormatter().
void SetClientContext(ContextDictionary clientContext, ApplicationContext.ExecutionLocations executionLocation)
Sets the client context.
IPrincipal GetUser()
Gets the current principal.
void SetUser(IPrincipal principal)
Sets the current principal.
ContextDictionary GetGlobalContext()
void SetGlobalContext(ContextDictionary globalContext)
void SetDefaultServiceProvider(IServiceProvider serviceProvider)
Sets the default IServiceProvider
IServiceProvider GetDefaultServiceProvider()
Gets the default IServiceProvider
void SetLocalContext(ContextDictionary localContext)
Sets the local context.
void SetServiceProvider(IServiceProvider scope)
Sets the service provider for current scope
ContextDictionary GetClientContext(ApplicationContext.ExecutionLocations executionLocation)
Gets the client context.
IServiceProvider GetServiceProvider()
Gets the service provider for current scope
ContextDictionary GetLocalContext()
Gets the local context.
Defines the interface for an application context manager type.