private static void SetCurrentScope(CallContextLifetimeScope lifetimeScope) { #if FEATURE_REMOTING CallContext.LogicalSetData(callContextKey, lifetimeScope.contextId); #else asyncLocal.Value = lifetimeScope.contextId; #endif }
public CallContextLifetimeScope(IKernel container) { var parent = ObtainCurrentScope(); if (parent != null) { parentScope = parent; } SetCurrentScope(this); }
public void Dispose() { var scope = Scope.ObtainCurrentScope(); if (scope != null) { scope.Dispose(); } }
public CallContextLifetimeScope() { contextId = Guid.NewGuid(); parentScope = ObtainCurrentScope(); var added = allScopes.TryAdd(contextId, this); Debug.Assert(added); SetCurrentScope(this); }
public ILifetimeScope GetScope(CreationContext context) { var scope = Scope.ObtainCurrentScope(); if (scope == null) { throw new InvalidOperationException("Scope was not available. Did you forget to call container.BeginScope()?"); } return(scope); }
public CallContextLifetimeScope() { var parent = ObtainCurrentScope(); if (parent != null) { parentScope = parent; } contextId = Guid.NewGuid(); var added = appDomainLocalInstanceCache.TryAdd(contextId, this); Debug.Assert(added); SetCurrentScope(this); }
public CallContextLifetimeScope() { var parent = ObtainCurrentScope(); if (parent != null) { parentScope = parent; } contextId = Guid.NewGuid(); #if DOTNET35 lock (cacheLocker) { appDomainLocalInstanceCache.Add(contextId, this); } #else var added = appDomainLocalInstanceCache.TryAdd(contextId, this); Debug.Assert(added); #endif SetCurrentScope(this); }
private void SetCurrentScope(CallContextLifetimeScope lifetimeScope) { CallContext.LogicalSetData(contextKey, lifetimeScope); }
private void SetCurrentScope(CallContextLifetimeScope lifetimeScope) { CallContext.LogicalSetData(keyInCallContext, lifetimeScope.contextId); }