Edit

Share via


ReceiveActivity.ContextToken Property

Definition

Represents a token that can be used to specify the context that should be used to correlate the exchange between a ReceiveActivity activity and the client that the activity is communicating with.

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

Property Value

A ContextToken that can be used for correlation.

Attributes

Examples

The following code example shows how to access the ContextToken property. This code example is adapted from the Conversations SDK sample, from the SupplierWorkflow.Designer.cs file.

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

Remarks

Each ContextToken is defined within the scope of an owner activity. Users can model two distinct context tokens with the same name but different owner scopes. The value of the contexts associated with these context tokens are different at runtime.

By default, each workflow has an implicit root context token, scoped at the root activity level. The name of the root context token is '(RootContext)' and the OwnerActivityName is null. If a ReceiveActivity activity does not have a ContextToken associated with it, the root context token is used.

Applies to