The While
activity is one activity that uses a condition. The While
activity will repeatedly execute its child activity until its Condition
property returns false. The Properties window for the While
activity allows us to set this Condition
property to a Code Condition or a Declarative Rule Condition. In the screenshot below, we've told the While
activity to use a code condition, and that the code condition is implemented in a method named CheckBugIndex
.
A code condition is an event handler in our code-beside file. A code condition returns a boolean value via a ConditionalEventArgs
parameter. Because a code condition is just another method on our workflow class, the conditional logic compiles into the same assembly that hosts our workflow definition.
The implementation of CheckBugIndex
is shown below. We have an array of bug objects for the workflow to process. The array might arrive as a parameter to the workflow, or through some other communication...