Partilhar via


Using the EventHandlersActivity Activity

The EventHandlersActivity activity is a framework for associating events with an activity. An EventHandlersActivity activity cannot exist on its own; it is always associated with another activity. The EventHandlersActivity activity contains an EventDrivenActivity collection for the associated activity to use.

When one of these child activities is executed more than once, a separate instance of the activity is created for each iteration. This enables the instances to execute independently (and potentially in parallel, as in the case of a ReplicatorActivity activity). Therefore, the definition of the child activity in the activity tree (referred to as the template) is never executed and is always in the Initialized state. Access to the running instances of the template is provided by the composite activity that is the parent of the template. For example, in the case of the EventHandlersActivity activity, there is always one active instance, and the GetDynamicActivity method retrieves this instance.

You can add an EventHandlersActivity activity as an optional child of an EventHandlingScopeActivity activity.

See Also

Reference

EventHandlersActivity
EventHandlingScopeActivity

Concepts

Using the EventDrivenActivity Activity
Using the EventHandlingScopeActivity Activity

Other Resources

Windows Workflow Foundation Activities