Пример #1
0
        private static void ScopeToLifetime(ConnectionScope scope, ILifetime lifetime)
        {
            switch (scope)
            {
            case ConnectionScope.ByRequest:
                lifetime.Request();
                break;

            case ConnectionScope.ByThread:
                lifetime.Thread();
                break;

            case ConnectionScope.BySession:
                lifetime.Session();
                break;

            case ConnectionScope.KeepAlive:
                lifetime.Permanent();
                break;

            case ConnectionScope.AlwaysNew:
                lifetime.AlwaysNew();
                break;

            default:
                throw new ArgumentOutOfRangeException("scope");
            }
        }