Ejemplo n.º 1
0
        public ILifetimeScope GetScope(CreationContext context)
        {
            IScopeAccessor scopeAccessor = cache.GetOrAdd(context, BuildScopeAccessor);
            ILifetimeScope lifetimeScope = scopeAccessor.GetScope(context);

            return(lifetimeScope);
        }
Ejemplo n.º 2
0
 public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context)
 {
     if (HttpContext.Current != null && (bool)initialized.GetValue(null))
     {
         return(webRequestScopeAccessor.GetScope(context));
     }
     return(secondaryScopeAccessor.GetScope(context));
 }
Ejemplo n.º 3
0
 public ILifetimeScope GetScope(Context.CreationContext context)
 {
     if (HttpContext.Current != null && PerWebRequestLifestyleModuleUtils.IsInitialized)
     {
         return(webRequestScopeAccessor.GetScope(context));
     }
     return(secondaryScopeAccessor.GetScope(context));
 }
Ejemplo n.º 4
0
        public ILifetimeScope GetScope(CreationContext context)
        {
            //if (HttpContext.Current != null && !HttpContext.Current.IsWebSocketRequest && PerWebRequestLifestyleModuleUtils.IsInitialized)
            if (HttpContext.Current != null && PerWebRequestLifestyleModuleUtils.IsInitialized)
            {
                //if (HttpContext.Current != null)
                return(webRequestScopeAccessor.GetScope(context));
            }

            return(TransientScopeAccessor.GetScope(context));
        }
Ejemplo n.º 5
0
 public ILifetimeScope GetScope(CreationContext context)
 {
     if (HttpContext.Current != null)
     {
         return(webRequestScopeAccessor.GetScope(context));
     }
     else
     {
         return(callContextScopeAccessor.GetScope(context));
     }
 }
        public override object Resolve(CreationContext context, IReleasePolicy releasePolicy)
        {
            var scope  = accessor.GetScope(context);
            var burden = scope.GetCachedInstance(Model, afterCreated =>
            {
                var localBurden = base.CreateInstance(context, trackedExternally: true);
                afterCreated(localBurden);
                Track(localBurden, releasePolicy);
                return(localBurden);
            });

            return(burden.Instance);
        }
        /// <inheritdoc />
        public ILifetimeScope GetScope(CreationContext context)
        {
            if (HttpContext.Current != null)
            {
                if (!isPerWebReqzestLifestyleModuleInitialized)
                {
                    isPerWebReqzestLifestyleModuleInitialized = IsWebRequestModuleInitialized();
                }

                if (isPerWebReqzestLifestyleModuleInitialized)
                {
                    return(webRequestScopeAccessor.GetScope(context));
                }
            }

            return(lifetimeScopeAccessor.GetScope(context));
        }