コード例 #1
0
        private static LifestyleType GetLifestyleTypeFrom(ComponentInstanciationPolicy callModel)
        {
            switch (callModel)
            {
            case ComponentInstanciationPolicy.NewInstance: return(LifestyleType.Transient);

            case ComponentInstanciationPolicy.Singleton: return(LifestyleType.Singleton);
            }

            return(LifestyleType.Undefined);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public void Configure <T>(ComponentInstanciationPolicy callModel)
 {
     ((IContainer)this).Configure(typeof(T), callModel);
 }