Exemplo n.º 1
0
        private void SetLifecycle <T>(ExpressedInstance <T> expressedInstance, RegistrationLifecycle lifecycle)
        {
            switch (lifecycle)
            {
            case RegistrationLifecycle.Transient:
                expressedInstance.LifecycleIs <TransientLifecycle>();
                break;

            case RegistrationLifecycle.Singletone:
                expressedInstance.LifecycleIs <SingletonLifecycle>();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 2
0
 public DynamicRegistration(Type serviceType, Func <Type, IResolveServices, object> findService, RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     ServiceType = serviceType;
     FindService = findService;
     Lifecycle   = lifecycle;
 }
Exemplo n.º 3
0
 public static IocConfiguration Register(this IocConfiguration iocConfiguration, Type serviceType,
                                         Func <Type, IResolveServices, object> findService,
                                         RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     return(iocConfiguration.Register(new DynamicRegistration(serviceType, findService, lifecycle)));
 }
Exemplo n.º 4
0
 public static IocConfiguration Register(this IocConfiguration iocConfiguration, Type serviceType, Type implimentationType,
                                         RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     return(iocConfiguration.Register(new NormalRegistration(serviceType, implimentationType, lifecycle)));
 }
Exemplo n.º 5
0
 public NormalRegistration(Type serviceType, Type implimentationType, RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     ServiceType        = serviceType;
     ImplimentationType = implimentationType;
     Lifecycle          = lifecycle;
 }