Chapter 57: Windows Workflow Foundation 3.0
What’s in This Chapter?
-
Built-in activities
-
Creating custom activities
-
Workflow Services
-
Integration with WCF
-
Hosting Workflows
-
Tips for migrating to Workflow Foundation 4
This chapter presents an overview of the Windows Workflow Foundation 3.0 (known as WF throughout the rest of this chapter), which provides a model to define and execute processes using a set of building blocks called activities. WF provides a Designer that, by default, is hosted within Visual Studio, and that allows you to drag and drop activities from the toolbox onto the design surface to create a workflow template.
This template can then be executed by creating a WorkflowInstance and then running that instance. The code that executes a workflow is known as the WorkflowRuntime, and this object can also host a number of services that the running workflows can access. At any time, there may be several workflow instances executing, and the runtime deals with scheduling these instances and saving and restoring state; it can also record the behavior of each workflow instance as it executes.
A workflow is constructed from a number of activities, and these activities are executed by the runtime. An activity might send an e-mail, update a row in a database, or execute a transaction on a back-end system. There are a number of built-in activities that can be used for general-purpose work, and you can also create your own custom activities and plug these into the workflow as necessary.
Note that with Visual Studio 2010 there is a new version of Windows Workflow which is not backward compatible. This chapter describes the older version of workflow; however, for new projects I recommend using the WF 4 version. Refer to Chapter 44, “Windows Workflow Foundation 4,” for further details. At the end of this chapter, I have also included a set of suggestions to make upgrading easier.
We begin with the canonical example that everyone uses when faced with a new technology—Hello World—and also describe what you need to get workflows running on your development machine.
This article is excerpted from chapter 57 "Windows Workflow Foundation 3.0" of the book "Professional C# 4 and .NET 4" by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner (ISBN: 978-0-470-50225-9, Wrox, 2010, Copyright Wiley Publishing Inc.)

