CorrelationInitializer.CorrelationHandle 属性

定义

获取或设置相关初始值设定项的 CorrelationHandle 参数。

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)

属性值

相关句柄自变量。

示例

下面的示例演示如何在 SendReply 活动中指定相关初始值设定项。

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

注解

运行时使用 CorrelationHandle 进行关联(如果存在),否则将使用消息传递活动的 CorrelatesWith 属性。 如果二者都不存在,则将使用 CorrelationScope 提供的环境句柄或工作流服务。

适用于