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();
            }
        }
Beispiel #2
0
 public DynamicRegistration(Type serviceType, Func <Type, IResolveServices, object> findService, RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     ServiceType = serviceType;
     FindService = findService;
     Lifecycle   = lifecycle;
 }
 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)));
 }
 public static IocConfiguration Register(this IocConfiguration iocConfiguration, Type serviceType, Type implimentationType,
                                         RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     return(iocConfiguration.Register(new NormalRegistration(serviceType, implimentationType, lifecycle)));
 }
Beispiel #5
0
 public NormalRegistration(Type serviceType, Type implimentationType, RegistrationLifecycle lifecycle = RegistrationLifecycle.Transient)
 {
     ServiceType        = serviceType;
     ImplimentationType = implimentationType;
     Lifecycle          = lifecycle;
 }