private global::SimpleInjector.Lifestyle Converter(Core.IoC.Lifestyle lifestyle) { switch (lifestyle) { case Core.IoC.Lifestyle.Singleton: return(global::SimpleInjector.Lifestyle.Singleton); case Core.IoC.Lifestyle.Transient: return(global::SimpleInjector.Lifestyle.Transient); default: return(global::SimpleInjector.Lifestyle.Scoped); } }
public void Register(Type from, Type to, Core.IoC.Lifestyle lifestyle) { _container.Register(from, to, Converter(lifestyle)); }
public void Register <TFrom, TTo>(Core.IoC.Lifestyle lifestyle = Core.IoC.Lifestyle.Transient) where TTo : TFrom { Register(typeof(TFrom), typeof(TTo), lifestyle); }
public void Register(Type from, Func <IContainer, object> to, Core.IoC.Lifestyle lifestyle) { _delegates.Add(from, to); _container.Register(from, () => to(this), Converter(lifestyle)); }
public void Register <TFrom>(Func <IContainer, object> to, Core.IoC.Lifestyle lifestyle = Core.IoC.Lifestyle.Transient) { _delegates.Add(typeof(TFrom), to); _container.Register(typeof(TFrom), () => to(this), Converter(lifestyle)); }
public void Register <TFrom>(Func <IContainer, object> to, Core.IoC.Lifestyle lifestyle = Core.IoC.Lifestyle.Transient) { Register(typeof(TFrom), to, lifestyle); }