コード例 #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
 private void RegisterBuiltInComponents()
 {
     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);
 }
コード例 #4
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);
        }