Пример #1
0
        private Scope GetScopeFromDefaultScopedLifestyle(Container container)
        {
            ScopedLifestyle lifestyle = container.Options.DefaultScopedLifestyle;

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

            return(null);
        }
Пример #2
0
        private Scope GetScopeFromDefaultScopedLifestyle(Container container)
        {
            ScopedLifestyle lifestyle = container.Options.DefaultScopedLifestyle;

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

            return(container.GetVerificationOrResolveScopeForCurrentThread()
                   ?? ThrowResolveFromScopeOrRegisterDefaultScopedLifestyleException());
        }
Пример #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);
        }
Пример #4
0
        protected override Scope GetCurrentScopeCore(Container container)
        {
            ScopedLifestyle lifestyle = GetDefaultScopedLifestyle(container);

            return(lifestyle.GetCurrentScope(container));
        }