Compartilhar via


IfElse with Rules Sample

Download sample

This sample shows the use of a rule condition with an IfElseActivity activity.

The sample passes in an OrderValue parameter from the host. The value of the parameter is used in a rule condition on the first branch of the IfElseActivity activity. If the value is less than 10,000, the first branch executes, and the CodeActivity activity in the first branch prints Get Manager Approval to the console. If the value is greater than 10,000, the CodeActivity activity in the second branch executes and prints Get VP Approval.

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the IfElseWithRules\bin\debug folder (or the IfElseWithRules\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also

Reference

System.Workflow.Activities.Rules
IfElseActivity
CodeActivity
RuleDefinitions

Other Resources

CodeDOM Types Supported by Windows Workflow Foundation
Using Conditions in Workflows
Using Rule Conditions in Workflows
Using Conditions through Code
Rules and Conditions Samples

© 2007 Microsoft Corporation. All rights reserved.