Presenter: Michael Stiefel
Windows Workflow Foundation contains a very powerful rules engine. However, the applications for such a rules engine do not always lend themselves to a Windows Workflow implementation. In this talk, Michael was able to show how the rules engine can used outside of the WWF framework. These notes will be updated in future posts as I work through the development of a custom wrapper and service class for abstracting the use of the rules engine.
Policy Activities
Policy activities contain rule sets. It is these rule sets that are processed when this policy activity is executed.
Rule Sets
A rule set consists of a collection of individual rules. Each rule is essentially an if...then...else construct. The then actions and else actions can modify properties and also invoke methods.
Chaining
There are three modes of chaining that can be selected for a particular rule set: Full Chaining, Sequential, or Explicit Update Only. Full chaining means that if one rule modifies a value that was used by a different rule that had already been run, the original rule can be re-evaluated taking into account the updated value.
Rule Priority
Rules have an explicit priority which is stored as a number. The higher the priority value, the higher the priority of the rule. If several rules have the same priority, they are run in alphabetical order.
Invoking the Rules Engine outside of Windows Workflow Foundation
.rules file
The rules definition file is compiled into the workflow project as a resource. Despite the fact that the rules file exists as xml on disk, replacing the file will not update the rules to be used because the WWF engine extracts the rules resource from the compiled dll at run time.
WorkflowMarkupSerializer
The WorkflowMarkupSerializer is used to deserialize an xml rules file into a RuleSet object.
RuleValidation
The RuleValidation class is used to validate a deserialized rule set to ensure that the rule set itself is valid.
RuleExecution
The RuleExecution object can be used to execute the rules against the object that will be operated upon.