Пример #1
0
        public override void RegisterComponent(string name, System.Type contractType, System.Type componentType, ComponentLifeStyleType lifestyle)
        {
            if (!componentTypes.Contains(contractType))
            {
                componentTypes.Add(new ComponentType(contractType));
            }
            IComponentBuilder builder = null;

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

            case ComponentLifeStyleType.Singleton:
                builder = new SingletonComponentBuilder(name, componentType);
                break;
            }
            AddBuilder(contractType, builder);
            registeredComponents[componentType] = name;
        }
 public override void RegisterComponent(string name, System.Type contractType, System.Type componentType, ComponentLifeStyleType lifestyle)
 {
     if (!componentTypes.Contains(contractType))
     {
         componentTypes.Add(new ComponentType(contractType));
     }
     IComponentBuilder builder = null;
     switch (lifestyle)
     {
         case ComponentLifeStyleType.Transient:
             builder = new TransientComponentBuilder(name, componentType);
             break;
         case ComponentLifeStyleType.Singleton:
             builder = new SingletonComponentBuilder(name, componentType);
             break;
     }
     AddBuilder(contractType, builder);
     registeredComponents[componentType] = name;
 }