Ejemplo n.º 1
0
        private InjectionInfo GetInjectionInfo(Type implementType, Type serviceType)
        {
            ConstructorInfo[] constInfos    = serviceType.GetConstructors();
            InjectionInfo     injectionInfo = new InjectionInfo(implementType, serviceType);

            if (constInfos.Length == 1)
            {
                injectionInfo.ServiceConstructor = constInfos[0];
            }

            return(injectionInfo);
        }
Ejemplo n.º 2
0
        public IRegister Callback(PostFunc postFunc)
        {
            if (!injectionHash.ContainsKey(implementType.FullName))
            {
                return(this);
            }
            InjectionInfo injectionInfo = injectionHash[implementType.FullName] as InjectionInfo;

            injectionInfo.PostFunc = postFunc;

            return(this);
        }
Ejemplo n.º 3
0
        public IRegister UsingConstructor(params Type[] argTypes)
        {
            if (!injectionHash.ContainsKey(implementType.FullName))
            {
                return(this);
            }
            InjectionInfo   injectionInfo = injectionHash[implementType.FullName] as InjectionInfo;
            ConstructorInfo constInfo     = injectionInfo.ServiceType.GetConstructor(argTypes);

            if (constInfo != null)
            {
                injectionInfo.ServiceConstructor = constInfo;
            }

            return(this);
        }