private void ProcessSingleton(BuildRuleElement buildRule, Type buildType) { if (buildRule.Mode == ModeElement.Singleton) { builder.Policies.Set <ISingletonPolicy>(new SingletonPolicy(true), buildType, null); } }
private void ProcessConstructor(BuildRuleElement buildRule, Type buildType) { if (buildRule.Constructor == null) { return; } ConstructorPolicy policy = new ConstructorPolicy(); foreach (object param in buildRule.Constructor.Items) { policy.AddParameter(GetParameterFromConfigParam(param)); } builder.Policies.Set <ICreationPolicy>(policy, buildType, null); }
private void ProcessProperties(BuildRuleElement buildRule, Type buildType) { if (buildRule.Property == null) { return; } PropertySetterPolicy policy = new PropertySetterPolicy(); foreach (PropertyElement prop in buildRule.Property) { policy.Properties.Add(prop.Name, new PropertySetterInfo(prop.Name, GetParameterFromConfigParam(prop.Item))); } builder.Policies.Set <IPropertySetterPolicy>(policy, buildType, null); }
private void ProcessMethods(BuildRuleElement buildRule, Type buildType) { if (buildRule.Method == null) { return; } MethodPolicy policy = GetMethodPolicy(buildType, null); foreach (MethodElement method in buildRule.Method) { List <IParameter> parameters = new List <IParameter>(); foreach (object param in method.Items) { parameters.Add(GetParameterFromConfigParam(param)); } policy.Methods.Add(method.Name, new MethodCallInfo(method.Name, parameters)); } }