This documentation is archived and is not being maintained.

Using Variables with a .NET Framework 3.5 Ruleset

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

This sample demonstrates how to create a workflow that uses the Interop activity to integrate a custom activity written in .NET Framework 3.5 that uses policy and rules. The workflow passes data to the custom activity by binding variables to the dependency properties exposed by the custom activity.

Sample walkthrough

To examine TravelRuleLibrary

  1. Using Visual Studio 2010, open the InteropWith35RuleSet.sln solution file.

  2. Open the TravelRuleSet.cs in the workflow designer.

    A custom sequential activity that contains a PolicyActivity is displayed.

  3. Double-click the DiscountPolicy policy activity to examine the rules.

    The Rules editor pops up to show the rules.

  4. Right click the DiscountPolicy and select the View Code option to examine the code beside C# code for the activity.

    Observe the dependency property setting for DiscountLevel. This is equivalent to arguments in .NET Framework 4. For more information aboutarguments, see Variables and Arguments.


This is a sequential workflow project that uses the Interop activity to integrate with the custom Rule set created in the TravelRuleLibrary project. Variables are created on the top level Sequence activity. The Interop activity is used to integrate with the TravelRuleSet activity. The variables that are declared on the Sequence are used to bind to the dependency properties.

To use this sample

  1. Using Visual Studio 2010, open the InteropWith35RuleSet.sln solution file.

  2. To build the solution, press CTRL+SHIFT+B.

  3. To run the solution, press CTRL+F5.

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


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.