private static void MergeBinding(IBindingConfig bindingConfig, IBindingConfig explicitBindingConfig) { // merge constructor if (explicitBindingConfig.Constructor != null) { bindingConfig.Constructor = explicitBindingConfig.Constructor; } // merge factory if (explicitBindingConfig.FactoryExpression != null) { bindingConfig.FactoryExpression = explicitBindingConfig.FactoryExpression; } // merge lifestyle if (explicitBindingConfig.Lifestyle != null) { bindingConfig.Lifestyle = explicitBindingConfig.Lifestyle; } foreach (var fis in explicitBindingConfig.GetFieldInfoSetters()) { bindingConfig.SetFieldInfoSetter(fis.MemberInfo, fis.MemberSetter); } foreach (var pis in explicitBindingConfig.GetPropertyInfoSetters()) { bindingConfig.SetPropertyInfoSetter(pis.MemberInfo, pis.MemberSetter); } }
private Expression CompileResolverExpression() { if (bindingConfig.FactoryExpression != null) { var factoryExpr = CompileFactoryExpr(); var fieldInjectors = bindingConfig.GetFieldInfoSetters(); var propertyInjectors = bindingConfig.GetPropertyInfoSetters(); if (fieldInjectors.Any() || propertyInjectors.Any()) { return(CompileFactoryExprSetters(factoryExpr, PropertiesResolver)); } else { return(factoryExpr); } } else { return(CompileConstructorExpr()); } }