We've used the runtime in previous chapters, but let's review what we've learned so far. The WorkflowRuntime
class is the host's gateway to Windows Workflow. A host creates an instance of the class, and then subscribes to one or more of the events mentioned in the table below. These events report state changes for all workflow instances that the runtime is executing.
Name |
Occurs |
---|---|
WorkflowAborted |
When an instance aborts |
WorkflowCompleted |
When the instance completes |
WorkflowCreated |
When a successful call to CreateWorkflow completes |
WorkflowIdled |
When a workflow enters an idle state |
WorkflowLoaded |
When a persistence service restores a workflow instance |
WorkflowPersisted |
When a persistence service saves a workflow |
WorkflowResumed |
When workflow execution continues after a suspension |
WorkflowStarted |
When a workflow firsts starts execution |
The code required to create the runtime and subscribe to events is relatively straightforward. The following example creates...