private static void CreateConfigWithMatchingRules(ContainerElement c) { var interceptionElement = new InterceptionElement(); var policy = new PolicyElement() { Name = "PolicyOne" }; policy.MatchingRules.Add(new MatchingRuleElement() { Name = "NameOnly" }); policy.MatchingRules.Add(new MatchingRuleElement() { Name = "NameAndType", TypeName = "AlwaysMatchingRule" }); policy.MatchingRules.Add(new MatchingRuleElement { Name = "RuleWithLifetime", TypeName = "AlwaysMatchingRule", Lifetime = new LifetimeElement() { TypeName = "singleton" } }); var ruleWithMembers = new MatchingRuleElement { Name = "RuleWithElements", TypeName = "AlwaysMatchingRule" }; ruleWithMembers.Injection.Add(new ConstructorElement()); ruleWithMembers.Injection.Add(new PropertyElement() { Name = "MyProp" }); policy.MatchingRules.Add(ruleWithMembers); interceptionElement.Policies.Add(policy); c.ConfiguringElements.Add(interceptionElement); }
private static void CreateConfigWithMatchingRules(ContainerElement c) { var interceptionElement = new InterceptionElement(); var policy = new PolicyElement() {Name = "PolicyOne"}; policy.MatchingRules.Add(new MatchingRuleElement() { Name = "NameOnly" }); policy.MatchingRules.Add(new MatchingRuleElement() { Name = "NameAndType", TypeName = "AlwaysMatchingRule" }); policy.MatchingRules.Add(new MatchingRuleElement { Name = "RuleWithLifetime", TypeName = "AlwaysMatchingRule", Lifetime = new LifetimeElement() { TypeName = "singleton" } }); var ruleWithMembers = new MatchingRuleElement { Name = "RuleWithElements", TypeName = "AlwaysMatchingRule" }; ruleWithMembers.Injection.Add(new ConstructorElement()); ruleWithMembers.Injection.Add(new PropertyElement() { Name = "MyProp" } ); policy.MatchingRules.Add(ruleWithMembers); interceptionElement.Policies.Add(policy); c.ConfiguringElements.Add(interceptionElement); }