Thinking about business rules in Enterprise Library 5.0

We’ve been exploring the feedback on business rules and how they may apply to EntLib. We see a number of possibly interesting scenarios, but they vary across a number of dimensions. We want to see if we can narrow down the options and what would be useful for EntLib to provide for most users.

Please note, the intention here is not to write our own business rules engine, but to leverage the platform as much as possible.

Taxonomy of Rules

During our exploration we settled on a basic taxonomy of rules that may be useful context for our discussions. This taxonomy is:

Constraints – Rules that enforce restriction on values, but do not change object state (e.g. only one invoice submitted per month)

Deduction/Process – Rules that may calculate or trigger action (e.g., calculating effective tax rates on a sale based on province or generating emails based on exceeding some threshold amounts).

Combination – Rules that combine the above.

Scenarios

In the context of the above, we’ve identified the following possible scenarios based on feedback from the Advisory Board.

1. Efficiency of Expression

Simplify the creation of custom validators by allowing lambda expressions to be passed to the validator and executed over an instance at some later date. This would be an extension to the Validation Application Block (VAB).

2. Invoke WF Rules Engine (WFRE) rule set from VAB

Provide the ability to invoke WFRE rules from VAB via a custom validator. This would allow externalizing some set of validation rules. These rules could take advantage of the forward chaining capabilities of the WFRE if any of the rules were to modify object state. It is unclear that mixing VAB rules and WFRE rules would produce predictable results of the WFRE modified object state after VAB rules were already invoked.

3. Common Rule Invocation

Provide a common mechanism for invoking ‘rules’ that may be executed from WFRE rules, VAB rules or potentially another rule execution provider. This would likely look like a typical provider model that abstracts the initial invocation over an object instance.

4. Ambient Execution

The rule evaluation is continuously performed in the background as object state changes. This is different than what VAB and WFRE currently offer, which is explicit rule execution.

5. Rule Hierarchies / Rule Merging

This would be the ability to coalesce hierarchies of rules to provide overrides at more specific levels or combine rule sets from different sources. This would largely be around WFRE, specifically. The complexity here may lie in rules that overlap or conflict.

 

Which of the above scenarios would be of value to you?