コード例 #1
0
        public void Configure <T>(Func <T> componentFactory, DependencyLifecycle dependencyLifecycle)
        {
            var componentType = typeof(T);

            if (HasComponent(componentType))
            {
                return;
            }

            var funcFactory = new ArbitraryFuncDelegatingFactoryObject <T>(componentFactory, dependencyLifecycle == DependencyLifecycle.SingleInstance);

            context.ObjectFactory.RegisterSingleton(componentType.FullName, funcFactory);
        }
コード例 #2
0
        void IContainer.Configure <T>(Func <T> componentFactory, DependencyLifecycle dependencyLifecycle)
        {
            var componentType = typeof(T);

            if (((IContainer)this).HasComponent(componentType))
            {
                return;
            }

            var funcFactory = new ArbitraryFuncDelegatingFactoryObject <T>(componentFactory, dependencyLifecycle == DependencyLifecycle.SingleInstance);

            ((IConfigurableApplicationContext)context).ObjectFactory.RegisterSingleton(componentType.FullName, funcFactory);
        }