예제 #1
0
        public virtual void Register(Type component)
        {
            if (component == null)
            {
                throw new ArgumentNullException();
            }

            Register(ComponentContextUtils.GetComponentDefaultName(component), ComponentContextUtils.CreateLocalFactory(component));
        }
예제 #2
0
        public virtual void Register(string name, Type componentType)
        {
            if (componentType == null)
            {
                throw new ArgumentNullException(nameof(componentType));
            }

            Register(name, ComponentContextUtils.CreateLocalFactory(componentType));
        }
예제 #3
0
        public virtual void Register(Type contract, string name, Type component)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }

            ComponentContextUtils.ThrowIfNotSubTypeOf(contract, component);

            InternalRegister(contract, name, ComponentContextUtils.CreateLocalFactory(component), true);
        }
예제 #4
0
        private void RegisterBuildInComponents()
        {
            InternalRegister(typeof(DefaultComponentCache), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(DefaultComponentCache)), false);
            InternalRegister(typeof(ContractAgnosticComponentCache), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(ContractAgnosticComponentCache)), false);
            InternalRegister(typeof(StaticComponentCache), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(StaticComponentCache)), false);
            InternalRegister(typeof(ThreadLocalComponentCache), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(ThreadLocalComponentCache)), false);

            InternalRegister(typeof(IClassEmitter), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(DefaultClassEmitter)), false);
            InternalRegister(typeof(IMethodEmitter), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(DefaultMethodEmitter)), false);
            InternalRegister(typeof(IPropertyEmitter), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(DefaultPropertyEmitter)), false);
            InternalRegister(typeof(IEventEmitter), null,
                             ComponentContextUtils.CreateLocalFactory(typeof(DefaultEventEmitter)), false);
        }