示例#1
0
        public override void RegisterComponent(string name, Type contractType, Type type, ComponentLifeStyleType lifestyle)
        {
            AddComponentType(contractType);

            IComponentBuilder builder = null;

            switch (lifestyle)
            {
            case ComponentLifeStyleType.Transient:
                builder = new TransientComponentBuilder(name, type);
                break;

            case ComponentLifeStyleType.Singleton:
                builder = new SingletonComponentBuilder(name, type);
                break;
            }
            AddBuilder(contractType, builder);

            RegisterComponent(name, type);
        }
        public override void RegisterComponent(string name, Type contractType, Type type, ComponentLifeStyleType lifestyle)
        {
            AddComponentType(contractType);

            IComponentBuilder builder = null;
            switch (lifestyle)
            {
                case ComponentLifeStyleType.Transient:
                    builder = new TransientComponentBuilder(name, type);
                    break;
                case ComponentLifeStyleType.Singleton:
                    builder = new SingletonComponentBuilder(name, type);
                    break;
            }
            AddBuilder(contractType, builder);

            RegisterComponent(name, type);
        }