This chapter covered the concepts and patterns related to the Windows Workflow Foundation state-machine workflow style. The state machine provides a great deal of functionality to effectively model business processes inside the workflow infrastructure.
State machines include concepts such as states and transitions. Each state represents a discrete position a workflow can be in at a given point in time. Unlike sequential workflows, state machines do not have to have a predefined execution path. States can transition back and forth and all around the workflow if the current process dictates this behavior.
Because there are two distinct types of workflows, you need to have a feel for the best scenarios for each type. Some things that may necessitate a state-machine workflow include a lot of human interaction and a lot of external events that can fire at any point in the process. Or you may find it difficult to model all of a process’s possible execution branches in a sequential workflow. Many times, it boils down to what feels right or natural for the current project.
Other topics relevant to state-machine workflows covered in this chapter include recursive state composition, querying a running workflow as to what state it is in or what transitions are possible, and moving states using a brute-force method. These concepts were illustrated in an extensive shopping cart example.