Export (0) Print
Expand All
Expand Minimize

Understanding the Activity Execution Context 

An ActivityExecutionContext (AEC) is the execution environment that is created for an activity when the host application calls the Start method.

The AEC provides a composite activity with the ability to execute (ExecuteActivity) or cancel (CancelActivity) a child activity. It can also close itself through the CloseActivity method. These are the only execution status changes that a parent activity can control through the AEC. All other activity states are controlled by the workflow runtime engine.

The AEC has a property called ExecutionContextManager that enables it to generate new AECs. These AECs are generated every time a parent activity, such as a WhileActivity activity, ReplicatorActivity activity, or ConditionedActivityGroup activity, runs its child activities more than once. Each iteration creates a cloned activity with its own AEC, so that these various instances of child activities can run independently (and possibly in parallel in the case of the ReplicatorActivity activity).

In addition, the ActivityExecutionContextManager recovers persisted contexts and completed contexts in which all activities are either in the Closed or Initialized states with optional persistence.

NoteNote

An AEC can only be completed when its associated activity is in the Closed or Initialized state.

An activity can only close when all spawned execution contexts (CreateExecutionContext) have been completed (CompleteExecutionContext). Violation of this behavior causes an exception to be thrown by the workflow runtime engine.

See Also

Footer image
Send comments about this topic to Microsoft.
Show:
© 2014 Microsoft