Correlated Calculator

This sample demonstrates how to use the messaging activities (Receive and SendReply) in the designer with content-based correlation based on a parameter in the message. In this scenario, the operations of the calculator are in a parallel convoy. Both an instance and a correlation (based on CalculatorId) are created when the first message is sent to the workflow, and subsequent messages with the same CalculatorId are dispatched to that instance until the Reset operation is called. The client is implemented as a WPF application that uses a code-based client proxy to communicate with the service.

To use this sample

  1. Start Visual Studio 2010 in elevated permissions, open the For.sln solution file.

    1. Navigate to the folder that contains Visual Studio 2010.

    2. Right-click Devenv.exe and select Run as administrator.

  2. Using Visual Studio 2010, open the CorrelatedCalculator.sln solution file.

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

  4. To run the service project, press CTRL+F5.

  5. Once the service is ready and listening for messages, in Solution Explorer, right-click the Client project and run it.

Important

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\Scenario\Services\CorellatedCalculator

See Also