CorrelationInitializer.CorrelationHandle Property

.NET Framework (current version)

Gets or sets the CorrelationHandle argument for the correlation initializer.

Namespace:   System.ServiceModel.Activities
Assembly:  System.ServiceModel.Activities (in System.ServiceModel.Activities.dll)

public InArgument<CorrelationHandle> CorrelationHandle { get; set; }

Property Value

Type: System.Activities.InArgument<CorrelationHandle>

The correlation handle argument.

The runtime uses the CorrelationHandle for correlation if it is present, otherwise the CorrelatesWith property of the messaging activity will be used. If both are absent, the ambient handle provided by CorrelationScope or the workflow service is used.

The following example shows how to specify the correlation initializer in a SendReply activity.

new SendReply
    Request = submitPO,
    Content = SendContent.Create(new InArgument<int>( (e) => po.Get(e).Id)), // creates a SendMessageContent
    CorrelationInitializers =
        new QueryCorrelationInitializer
            // initializes a correlation based on the PurchaseOrder Id sent in the reply message and stores it in the handle
            CorrelationHandle = poidHandle,
            MessageQuerySet = new MessageQuerySet
                // int is the name of the parameter being sent in the outgoing response
                { "PoId", new XPathMessageQuery("sm:body()/ser:int", Constants.XPathMessageContext) }

.NET Framework
Available since 4.0
Return to top