9using System.Security.Principal;
10using System.Threading;
22 private const string _localContextName =
"Csla.LocalContext";
23 private const string _clientContextName =
"Csla.ClientContext";
45 IPrincipal result = Thread.CurrentPrincipal;
48 result =
new System.Security.Claims.ClaimsPrincipal();
58 public virtual void SetUser(IPrincipal principal)
60 Thread.CurrentPrincipal = principal;
68 LocalDataStoreSlot slot = Thread.GetNamedDataSlot(_localContextName);
78 LocalDataStoreSlot slot = Thread.GetNamedDataSlot(_localContextName);
79 Thread.SetData(slot, localContext);
94 LocalDataStoreSlot slot = Thread.GetNamedDataSlot(_clientContextName);
108 AppDomain.CurrentDomain.SetData(_clientContextName, clientContext);
112 LocalDataStoreSlot slot = Thread.GetNamedDataSlot(_clientContextName);
113 Thread.SetData(slot, clientContext);
117 private const string _applicationContextName =
"Csla.ApplicationContext";
126 var slot = Thread.GetNamedDataSlot(_applicationContextName);
131 var slot = Thread.GetNamedDataSlot(_applicationContextName);
132 Thread.SetData(slot, value);
Provides consistent context information between the client and server DataPortal objects.
ExecutionLocations
Enum representing the locations code can execute.
Context manager for the user property and local/client/global context dictionaries that uses thread l...
void SetLocalContext(ContextDictionary localContext)
Sets the local context dictionary.
void SetClientContext(ContextDictionary clientContext, ApplicationContext.ExecutionLocations executionLocation)
Sets the client context dictionary.
ApplicationContext ApplicationContext
Gets or sets a reference to the current ApplicationContext.
virtual IPrincipal GetUser()
Gets the current user principal.
ContextDictionary GetClientContext(ApplicationContext.ExecutionLocations executionLocation)
Gets the client context dictionary.
virtual void SetUser(IPrincipal principal)
Sets the current user principal.
bool IsValid
Returns a value indicating whether the context is valid.
ContextDictionary GetLocalContext()
Gets the local context dictionary.
bool IsStatefulContext
Gets a value indicating whether the context manager is stateful.
Dictionary type that is serializable with the SerializationFormatterFactory.GetFormatter().
Defines the interface for an application context manager type.