Understanding Rule Editor Modes in Code Effects
Rule Editor can be rendered on the client in 5 modes: Evaluation, Execution,
Filter, Ruleset, and Loop.
To switch the Rule Editor into a different mode, set the value of RuleEditor.Mode
property to one of the members of RyleType enumeration.
<%@ Register assembly="CodeEffects.Rule"
namespace="CodeEffects.Rule.Asp" tagprefix="cc1" %>
<cc1:RuleEditor ID="RuleEditor1" runat="server"
The different modes of the Rule Editor control its behavior:
Evaluation Mode. This is the default mode. It allows rule authors to create only evaluation type rules, and the options in the Toolbar's Rules menu enforce that restriction.
Execution Mode. This mode allows rule authors to create both evaluation and execution type rules. Again, the options in the Toolbar's Rules menu enforce that restriction.
Filter Mode. This mode sets up Rule Editor for rule-based data filtering. It allows only evaluation type rules because, in a nutshell, filtering queries is nothing more than an evaluation type rule. This mode changes all labels and messages and hides the Toolbar, but you can show the Toolbar in filter mode by setting the RuleEditor.ShowToolBar to True if you'd like to let users manage their filters. The implementation of that is up to you. Data filtering is a huge topic, please make sure to read all of the details in these related articles.
Ruleset Mode. This mode allows rule authors to create a set of execution type rules, and evaluate those rules against a source object in a single evaluation step. In other words, using this mode the rule authors can evaluate a set of rules as if they were a single business rule.
This is the only mode that allows multiple If flow elements in the rule area, which serve as rule separators. No other flow elements such as Else If and Else are allowed in this mode.
The following is a simple example of a rule created using the Ruleset mode:
You can control the behavior of the rule evaluation by passing an instance of the EvaluationParameters class to Evaluator.
Loop Mode. This mode allows rule authors to create only execution type rules, and evaluate those rules against a source object in a continuous loop until the rule returns True, or until the loop reaches a predefined number of iterations.
The Loop mode alows only a single if flow element per rule meaning that the rule can contain only one section (see the Code Effects Basics topic for details on rule elements). This mode changes the flow label from if to while and the action clause from then to do. Using the EvaluationParameters class you can define the max number of iterations after which the Evauator class terminates evaluation while the rule still returns False. The default max number of iterations is -1 meaning the indefinite number of iterations.
The following is a simple example of a rule created using the Loop mode:
Post your support requests on Stackoverflow.com
. You can also post your comments and product feedback using the form below.