OverloadGroups

This topic applies to Windows Workflow Foundation 4 (WF4).

This sample consists of an activity (CreateLocation), which has two interesting characteristics:

  1. It has some required arguments and some optional ones.

  2. It allows the user to choose to provide one of two different sets of arguments.

These behaviors are accomplished by using these two features:

  • [isRequired] validates that a property of a specific activity is assign, and if not, it throws an exception.

  • [OverloadGroup] puts together a set of arguments, so that the user of the activity can choose between using one set or another. The user cannot use arguments from different Overload Groups in the same instance.

After setting up different workflows, call Validate which returns a ValidationResults collection of ConstraintViolation. Print the ConstraintViolation objects to the console.

To set up, build, and run the sample

  1. Open the OverloadGroups.sln sample solution in Visual Studio 2010.

  2. Build and run the solution.

Dd759029.Important(en-us,VS.100).gif Note:
The samples may already be installed on your computer. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Basic\Validation\OverloadGroups