How can I combine rulesets to have common and specific sets of rules? For example, at design time, it would be great to say
- RS1 executes all rules from RSCommon and RSSpecific1
- RS2 executes all rules from RSCommon and RSSpecific2
From one of my favorite devs (who doesn't have a blog yet):
RuleSet rs1 = newRuleSet("RS1");
foreach (Rule r in RSCommon.Rules)
rs1.Rules.Add(r);
foreach (Rule r in RSSpecific1.Rules)
rs1.Rules.Add(r);
RuleEngine engine = newRuleEngine(rs1, typeof(MyWorkflowType));
engine.Execute(thisObject);
N.B.: When two rule sets are merged into one, rules from one set are not executed as a block; they are interleaved with rules from the other set based on priority. If this isn't the behavior you want, you may wish to consider a convention over priorities or simply executing the two rule sets sequentially.
Posted
May 23 2006, 03:18 PM
by
jeffrey-schlimmer