示例#1
0
        public IConstructor ProvideConstructor(IService service)
        {
            if (HasConstructorParametersChecker.Check(service))
            {
                ConstructorInfo[]          constructorInfos = InfoListGenerator.GenerateList(service.Registration.TargetType);
                IEnumerable <IConstructor> constructors     = ListGenerator.GenerateList(constructorInfos);
                IConstructor constructor = ConstructorFinder.FindBy(constructors, service.Registration.RegistrationFlags.SelectValueOrNull <IConstructorParameters>(RegistrationFlagConstants.ConstructorParameters));

                return(constructor);
            }

            else
            {
                return(ConstructorProvider.ProvideConstructor(service));
            }
        }
        public IEnumerable <IParameter> GenerateParameters(IConstructor constructor, IService service, IReadOnlyContainer container)
        {
            // TODO another dependency LIKE SMART PARAMETERS GENERATOR in dependent to service ctor parameters.
            // LIKE

            if (ServiceHasConstructorParametersChecker.Check(service))
            {
                object constructorParameters = service.Registration.RegistrationFlags
                                               .SingleOrDefault(x => x.Code == RegistrationFlagConstants.ConstructorParameters).Value;

                return(GenerateParameters(constructor, constructorParameters as IConstructorParameters));
            }

            else
            {
                return(GenerateParameters(constructor, container));
            }
        }