Example #1
0
 public ContainerServices(IActivatorStore activatorStore, IActivatorFactory activatorFactory, ILifestyleFactory lifestyleFactory, IListenerInvoker listenerInvoker, IObjectInstances objectInstances, IServiceEntryFactory serviceEntryFactory, IServiceEntryResolver serviceEntryResolver, IServiceGraph serviceGraph, ContainerStatePolicy statePolicy, IResolvableTypeMap resolvableTypeMap)
 {
     _activatorStore = activatorStore;
       _resolvableTypeMap = resolvableTypeMap;
       _serviceEntryFactory = serviceEntryFactory;
       _statePolicy = statePolicy;
       _serviceGraph = serviceGraph;
       _activatorFactory = activatorFactory;
       _lifestyleFactory = lifestyleFactory;
       _listenerInvoker = listenerInvoker;
       _objectInstances = objectInstances;
       _serviceEntryResolver = serviceEntryResolver;
 }
Example #2
0
        /// <summary>
        /// 构造内核容器
        /// </summary>
        /// <param name="listenManager">组件监听管理器</param>
        /// <param name="lifestyleManagerRegistry">生命周期管理器注册表</param>
        /// <param name="activatorFactory">组件工厂的工厂</param>
        /// <param name="classLoader">类型加载器</param>
        public Kernel(
            IComponentListenerManager listenManager,
            ILifestyleManagerFactory lifestyleManagerRegistry,
            IActivatorFactory activatorFactory,
            IClassLoader classLoader)
        {
            if (listenManager == null)
            {
                throw new ArgumentNullException("listenManager");
            }
            if (lifestyleManagerRegistry == null)
            {
                throw new ArgumentNullException("lifestyleManagerRegistry");
            }
            if (activatorFactory == null)
            {
                throw new ArgumentNullException("activatorFactory");
            }
            if (classLoader == null)
            {
                throw new ArgumentNullException("classLoader");
            }

            ListenerManager          = listenManager;
            LifestyleManagerRegistry = lifestyleManagerRegistry;
            ActivatorRegistry        = activatorFactory;

            IdStores   = new Dictionary <string, ComponentRegistration>(StringComparer.OrdinalIgnoreCase);
            TypeStores = new Dictionary <Type, List <ComponentRegistration> >();

            Listner = ListenerManager as IComponentListener;

            RegisterInstance("ServiceLocator", typeof(IServiceLocator), this);
            RegisterInstance("ServiceRegistry", typeof(IServiceRegistry), this);


            RegisterInstance(AppDomain.CurrentDomain.Id.ToString() + ":" + classLoader.GetType(), typeof(IClassLoader), classLoader);

            ListenerManager.Init(this);

            RegisterListners();
            ListenerManager.Enabled = true;
        }
Example #3
0
 public TransientLifestyle(IActivatorFactory activatorFactory, ServiceEntry serviceEntry)
 {
     _activatorFactory = activatorFactory;
       _entry = serviceEntry;
 }
Example #4
0
 public PerThreadLifestyle(IActivatorFactory activatorFactory, ServiceEntry serviceEntry)
     : base(activatorFactory, serviceEntry)
 {
 }
Example #5
0
 public HybridLifestyle(IActivatorFactory activatorFactory, ServiceEntry entry)
 {
     _aspDotNet = new AspDotNet();
       _perPerWebRequestLifestyle = new PerWebRequestLifestyle(activatorFactory, entry);
       _perThreadLifestyle = new PerThreadLifestyle(activatorFactory, entry);
 }
 public DynamicProxyActivatorFactory(IMachineContainer container, IProxyBuilder proxyBuilder, IActivatorFactory defaultActivatorFactory)
 {
     _container = container;
       _defaultActivatorFactory = defaultActivatorFactory;
       _proxyBuilder = proxyBuilder;
 }
Example #7
0
 public LifestyleFactory(IActivatorFactory activatorFactory)
 {
     _activatorFactory = activatorFactory;
 }