Esempio n. 1
0
        private static LifetimeManager GetLifetimeManager(HandlerLifetime handlerLifetime)
        {
            switch (handlerLifetime)
            {
            case HandlerLifetime.Transient:
                return(new TransientLifetimeManager());

            case HandlerLifetime.PerRequest:
                return(new HierarchicalLifetimeManager());

            case HandlerLifetime.Singleton:
                return(new ContainerControlledLifetimeManager());

            default:
                throw new InvalidEnumArgumentException("handlerLifetime", (int)handlerLifetime, typeof(HandlerLifetime));
            }
        }
Esempio n. 2
0
        private static LifetimeManager GetLifetimeManager(HandlerLifetime handlerLifetime)
        {
            switch (handlerLifetime)
            {
                case HandlerLifetime.Transient:
                    return new TransientLifetimeManager();

                case HandlerLifetime.PerRequest:
                    return new HierarchicalLifetimeManager();

                case HandlerLifetime.Singleton:
                    return new ContainerControlledLifetimeManager();

                default:
                    throw new InvalidEnumArgumentException("handlerLifetime", (int)handlerLifetime, typeof(HandlerLifetime));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HandlerLifetimeAttribute"/> class.
 /// <param name="handlerLifetime">The handler lifetime.</param>
 /// </summary>
 public HandlerLifetimeAttribute(HandlerLifetime handlerLifetime)
 {
     this.HandlerLifetime = handlerLifetime;
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HandlerLifetimeAttribute"/> class. 
 /// <param name="handlerLifetime">The handler lifetime.</param>
 /// </summary>
 public HandlerLifetimeAttribute(HandlerLifetime handlerLifetime)
 {
     this.HandlerLifetime = handlerLifetime;
 }