Exemplo n.º 1
0
 public object GetContainerSpecificLifecycle(ObjectLifecycle lifecycle)
 {
     return(lifecycle switch
     {
         ObjectLifecycle.Singleton => Lifestyle.Singleton,
         ObjectLifecycle.Transient => Lifestyle.Transient,
         _ => throw new ArgumentOutOfRangeException(nameof(lifecycle), lifecycle, null),
     });
        public object GetContainerSpecificLifecycle(ObjectLifecycle lifecycle)
        {
            switch (lifecycle)
            {
            case ObjectLifecycle.Singleton:
                return(Lifestyle.Singleton);

            case ObjectLifecycle.Transient:
                return(Lifestyle.Transient);

            default:
                throw new ArgumentOutOfRangeException(nameof(lifecycle), lifecycle, null);
            }
        }
Exemplo n.º 3
0
 public virtual void Register <TInterface, TImplementation>(ObjectLifecycle lifecycle) where TInterface : class where TImplementation : class, TInterface
 {
     _container.Register <TInterface, TImplementation>((Lifestyle)_lifecycleConverter.GetContainerSpecificLifecycle(lifecycle));
 }