public static void Register <TInterface, TImplementation>(CrucialLifestyleType lifestyleType) where TInterface : class where TImplementation : TInterface { ComponentRegistration <TInterface> componentRegistration = Component.For <TInterface>().ImplementedBy <TImplementation>(); Resolver.Container.Register(componentRegistration.LifeStyle.Is((LifestyleType)lifestyleType)); }
public static void RegisterAllFromAssembliesEndingWith <T>(CrucialLifestyleType lifestyleType, string endsWith, bool performanceLogging = false) { Resolver.Container.Register( Classes.FromAssemblyContaining <T>() .Where(t => t.Name.EndsWith(endsWith)) .WithService.AllInterfaces() .Configure(c => c.LifeStyle.Is((LifestyleType)lifestyleType)) .ConfigureIf( c => performanceLogging, c => c.Interceptors("Crucial.Framework.Interceptors.PerformanceInterceptor") ) ); }
public static void RegisterAllFromAssemblies <T>(CrucialLifestyleType lifestyleType, bool performanceLogging = false) { Resolver.Container.Register( Classes.FromAssemblyContaining <T>() .BasedOn <Crucial.Framework.IoC.IAutoRegister>() .WithService.FromInterface() .Configure(c => c.LifeStyle.Is((LifestyleType)lifestyleType)) .ConfigureIf( c => performanceLogging, c => c.Interceptors("Crucial.Framework.Interceptors.PerformanceInterceptor") ) ); }
public static void Register <TInterface, TImplementation>(CrucialLifestyleType lifestyleType, params KeyValuePair <string, object>[] parameters) where TInterface : class where TImplementation : TInterface { if (parameters == null) { throw new ArgumentNullException("parameters"); } if (!parameters.Any()) { throw new ArgumentException("Must pass at least one parameter"); } ComponentRegistration <TInterface> componentRegistration = Component.For <TInterface>().ImplementedBy <TImplementation>().LifeStyle.Is((LifestyleType)lifestyleType); BuildComponentRegistrationWithParameters(ref componentRegistration, parameters); Resolver.Container.Register(componentRegistration); }
public static void Register(Type interfaceType, Type implementationType, CrucialLifestyleType lifestyleType) { Resolver.Container.Register(Component.For(interfaceType).ImplementedBy(implementationType).LifeStyle.Is((LifestyleType)lifestyleType)); }