ReceiveActivity.ContextToken 属性

定义

表示一个可用于指定上下文的令牌,应当使用该令牌来关联 ReceiveActivity 活动和该活动与之通信的客户端之间的交换。

public:
 property System::Workflow::Activities::ContextToken ^ ContextToken { System::Workflow::Activities::ContextToken ^ get(); void set(System::Workflow::Activities::ContextToken ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Workflow.Activities.ContextTokenTypeConverter))]
public System.Workflow.Activities.ContextToken ContextToken { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Workflow.Activities.ContextTokenTypeConverter))>]
member this.ContextToken : System.Workflow.Activities.ContextToken with get, set
Public Property ContextToken As ContextToken

属性值

ContextToken

可用于关联的 ContextToken

属性

示例

下面的代码示例演示如何访问 ContextToken 属性。 此代码示例根据 Conversations 文件中的 SupplierWorkflow.Designer.cs SDK 示例改写。

ReceiveActivity receiveQuoteFromShipper3;
receiveQuoteFromShipper3 = new System.Workflow.Activities.ReceiveActivity();
System.Workflow.Activities.ContextToken contexttoken1 = new System.Workflow.Activities.ContextToken();
contexttoken1.Name = "Shipper3Context";
receiveQuoteFromShipper3.ContextToken = contexttoken1;

注解

每个 ContextToken 均在所有者活动的范围内定义。 用户可以建立名称相同但所有者范围不同的两个不同的上下文令牌模型。 与这些上下文令牌关联的上下文的值在运行时将有所不同。

默认情况下,每个工作流都具有一个隐式根上下文令牌,其范围是根活动级别。 根上下文令牌的名称为“(RootContext)”,OwnerActivityNamenull。 如果 ReceiveActivity 活动没有与其关联的 ContextToken,则将使用根上下文标记。

适用于