Udostępnij za pośrednictwem


Simple Policy Sample

Download sample

This sample shows how to use a PolicyActivity activity in a workflow.

The sequential workflow in this sample is created by using a PolicyActivity activity. The workflow defines orderValue, customerType, and discount fields that are used to define a product discount workflow. The rules defined in the rules file set a discount value that is based on the orderValue and customerType. The orderValue and customerType are set in the SimplePolicyWorkflow class definition and can be changed to alter the behavior. The resulting discount is written to the console in the WorkflowCompleted event handler that is defined in the SimplePolicyWorkflow class.

To build the sample

  1. Download the sample by clicking Download Sample in this topic.

    This will extract 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 SimplePolicy\bin\debug folder (or the SimplePolicy\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample..

See Also

Reference

RuleSet
PolicyActivity

Other Resources

Advanced Policy Sample
Using the PolicyActivity Activity
Using Conditions in Workflows
Tutorial: Use Rules and Conditions
Activities Samples
Windows Workflow Foundation Samples

© 2007 Microsoft Corporation. All rights reserved.