Redigera

Dela via


CorrelationInitializer.CorrelationHandle Property

Definition

Gets or sets the CorrelationHandle argument for the correlation initializer.

public:
 property System::Activities::InArgument<System::ServiceModel::Activities::CorrelationHandle ^> ^ CorrelationHandle { System::Activities::InArgument<System::ServiceModel::Activities::CorrelationHandle ^> ^ get(); void set(System::Activities::InArgument<System::ServiceModel::Activities::CorrelationHandle ^> ^ value); };
public System.Activities.InArgument<System.ServiceModel.Activities.CorrelationHandle> CorrelationHandle { get; set; }
member this.CorrelationHandle : System.Activities.InArgument<System.ServiceModel.Activities.CorrelationHandle> with get, set
Public Property CorrelationHandle As InArgument(Of CorrelationHandle)

Property Value

The correlation handle argument.

Examples

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) }
            }
        }
    }
},

Remarks

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.

Applies to