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
Using Visual Studio 2010, open the InteropWith35RuleSet.sln solution file.
Open the TravelRuleSet.cs in the workflow designer.
A custom sequential activity that contains a PolicyActivity is displayed.
Double-click the DiscountPolicy policy activity to examine the rules.
The Rules editor pops up to show the rules.
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.
InteropWith35RuleSet
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
Using Visual Studio 2010, open the InteropWith35RuleSet.sln solution file.
To build the solution, press CTRL+SHIFT+B.
To run the solution, press CTRL+F5.
Note: |
---|
The samples may already be installed on your machine. 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\Built-InActivities\InteropWith35RuleSet
|