This chapter covered a great deal related to rules in Windows Workflow Foundation. The business rules framework provides a rich, flexible, and extensible platform on which rules can be developed, stored, and evaluated. Three types of rules were covered in this chapter: code conditions, declarative rule conditions, and rules as they exist in rule sets. Code conditions are static, code-based expressions that provide condition-dependent activities with their necessary Boolean values. Declarative rule conditions take code conditions to the next level by providing a more flexible, dynamic method of configuring certain activities, such as IfElseBranch and While.
Rule sets are where rules get interesting. This grouping of individual rules, which have their own associated actions such as THEN and ELSE, provides a great deal of functionality for business rules management and execution. Rule sets have several options related to how they are executed as a whole. This execution style is referred to as chaining. Rule sets are generally evaluated in a workflow with the Policy activity, which points to a specific rule set reference.
There are also several ways in which rules can be defined. Most of the time, rules will probably be authored and managed inside Visual Studio, which provides dialog boxes for rule conditions and rule sets. However, you can provide rule authoring capabilities in custom applications. In addition, you can programmatically create rules by using the Windows Workflow Foundation rules API and the classes in System.CodeDom.