HandleExternalEventActivity.OnInvoked(EventArgs) Method

Definition

Called just after the external event is received to allow derived classes to process the inbound EventArgs before the activity closes.

C#
protected virtual void OnInvoked(EventArgs e);

Parameters

e
EventArgs

The EventArgs that are received from the external event that was just received.

Examples

The following example shows an implementation of the OnInvoked method. This example is from the Correlated Local Service SDK sample, from the TaskCompleted.cs file. For more information, see Correlated Local Service Sample.

C#
private WorkflowQueue CreateQueue(ActivityExecutionContext context)
{
    Console.WriteLine("CreateQueue");
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();

    if (!qService.Exists(this.QueueName))
    {
        qService.CreateWorkflowQueue(this.QueueName, true);
    }

    return qService.GetWorkflowQueue(this.QueueName);
}

Remarks

The most common use of the OnInvoked method in derived classes is to extract members from the received EventArgs to set the values of the derived-classed activity's public properties.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also