public void RegisterType(Type tInterface, Type tConstruct)
 {
     lock (this)
     {
         _resolvers[tInterface] = new ConstructingResolver(tConstruct, this);
     }
 }
示例#2
0
        public void RegisterType(Type tFrom, Type tTo)
        {
            IResolver resolver = null;

            if (tFrom.GetTypeInfo().IsGenericTypeDefinition)
            {
                resolver = new ConstructingOpenGenericResolver(tTo, this);
            }
            else
            {
                resolver = new ConstructingResolver(tTo, this);
            }

            InternalSetResolver(tFrom, resolver);
        }
示例#3
0
        public void RegisterType(Type interfaceType, Type constructType)
        {
            IResolver resolver = null;

            if (interfaceType.GetTypeInfo().IsGenericTypeDefinition)
            {
                resolver = new ConstructingOpenGenericResolver(constructType, this);
            }
            else
            {
                resolver = new ConstructingResolver(constructType, this);
            }

            InternalSetResolver(interfaceType, resolver);
        }
示例#4
0
        public void RegisterType <TInterface, TToConstruct>()
            where TInterface : class
            where TToConstruct : class, TInterface
        {
            var       interfaceType = typeof(TInterface);
            var       constructType = typeof(TToConstruct);
            IResolver resolver;

            if (interfaceType.GetTypeInfo().IsGenericTypeDefinition)
            {
                resolver = new ConstructingOpenGenericResolver(constructType, this);
            }
            else
            {
                resolver = new ConstructingResolver(constructType, this);
            }

            InternalSetResolver(interfaceType, resolver);
        }
        public void RegisterType(Type tInterface, Type tConstruct)
        {
            var resolver = new ConstructingResolver(tConstruct, this);

            InternalSetResolver(tInterface, resolver);
        }