Every activity in Windows Workflow must be in one of six states. These states are represented by the ActivityExecutionStatus
enumeration: Initialized, Executing, Closed, Canceling, Compensating
, and Faulting
. All activities begin in the Initialized
state, and all activities end in the Closed
state. The possible state transitions are shown in the figure below:
There are a couple of important comments to make about this diagram. First, the only way for an activity to transition to the Closed
state is for the activity to announce to the workflow runtime that it is finished executing. An activity makes this announcement by returning ActivityExecutionStatus.Closed
from one of the virtual methods discussed in the next paragraph.
All other state transitions coincide with a virtual method call to an activity. For example, the runtime invokes an activity's Execute
method when the activity reaches the Executing
state. The runtime invokes the Cancel
method when the
activity reaches...