Aracılığıyla paylaş


Content-Based Correlation

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

This sample demonstrates how the messaging activities (Send, Receive, SendReply, and ReceiveReply) can be used with multiple content-based correlations.and content-based correlation. In this scenario, a correlation is first initialized based on a purchase order ID, and then another correlation is created later based on the customer ID. This shows how a Receive activity can both follow an existing correlation and initialize a new correlation based on the same incoming message.

Demonstrates

Messaging activities and content-based correlation

Discussion

This sample shows how to use multiple content-based correlations. In this scenario, a correlation is first initialized based on a purchase order ID, and then another correlation is created later based on the customer ID. The correlations are cascaded using a Receive activity that both follows an existing correlation (PurchaseOrderId) and initializes a new correlation (CustomerId) based on the same incoming message. To accomplish this, the Receive activity uses the CorrelatesOn, CorrelatesWith and CorrelationInitializers properties.

To use this sample

  1. Open Visual Studio 2010 with elevated permissions, by right-clicking the Visual Studio 2010 icon and selecting Run as administrator.

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

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

  4. To run the server, press F5.

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

Dd807508.Important(en-us,VS.100).gif 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\Services\ContentBasedCorrelation