Ejemplo n.º 1
0
        private Scope GetScopeFromDefaultScopedLifestyle(Container container)
        {
            ScopedLifestyle lifestyle = container.Options.DefaultScopedLifestyle;

            if (lifestyle != null)
            {
                return(lifestyle.GetCurrentScope(container) ?? ThrowThereIsNoActiveScopeException());
            }

            return(null);
        }
Ejemplo n.º 2
0
        private Scope GetScopeFromDefaultScopedLifestyle(Container container)
        {
            ScopedLifestyle lifestyle = container.Options.DefaultScopedLifestyle;

            if (lifestyle != null)
            {
                return(lifestyle.GetCurrentScope(container) ?? ThrowThereIsNoActiveScopeException());
            }

            return(container.GetVerificationOrResolveScopeForCurrentThread()
                   ?? ThrowResolveFromScopeOrRegisterDefaultScopedLifestyleException());
        }
Ejemplo n.º 3
0
        private Scope GetScopeFromDefaultScopedLifestyle(Container container)
        {
            ScopedLifestyle lifestyle = container.Options.DefaultScopedLifestyle;

            if (lifestyle != null)
            {
                return(lifestyle.GetCurrentScope(container) ?? ThrowThereIsNoActiveScopeException());
            }

            if (container.GetVerificationOrResolveScopeForCurrentThread() == null)
            {
                ThrowResolveFromScopeOrRegisterDefaultScopedLifestyleException();
            }

            // We return null instead of one of the scope returned from the previous method call,
            // since the CreateCurrentScopeProvider contract states that we should return null.
            return(null);
        }
Ejemplo n.º 4
0
        protected override Scope GetCurrentScopeCore(Container container)
        {
            ScopedLifestyle lifestyle = GetDefaultScopedLifestyle(container);

            return(lifestyle.GetCurrentScope(container));
        }