private static LifestyleType GetLifestyleTypeFrom(ComponentInstanciationPolicy callModel) { switch (callModel) { case ComponentInstanciationPolicy.NewInstance: return(LifestyleType.Transient); case ComponentInstanciationPolicy.Singleton: return(LifestyleType.Singleton); } return(LifestyleType.Undefined); }
public void Configure(Type t, ComponentInstanciationPolicy callModel) { var handler = GetHandlerForType(t); if (handler == null) { var reg = Component.For(GetAllServiceTypesFor(t)).ImplementedBy(t); reg.LifeStyle.Is(GetLifestyleTypeFrom(callModel)); Container.Kernel.Register(reg); } }
public void Configure <T>(ComponentInstanciationPolicy callModel) { ((IContainer)this).Configure(typeof(T), callModel); }