What's New in Windows Workflow Foundation

This topic applies to Windows Workflow Foundation 4 (WF4).

Windows Workflow Foundation (WF) in .NET Framework version 4 changes several development paradigms from previous versions. Workflows are now easier to create, execute, and maintain, and implement a host of new functionality.

Workflow Activity Model

The activity is now the base unit of creating a workflow, rather than using the SequentialWorkflowActivity or StatemachineWorkflowActivity classes. The Activity class provides the base abstraction of workflow behavior. Activity authors can then implement either CodeActivity for basic custom activity functionality, or NativeActivity for custom activity functionality that uses the breadth of the runtime. Activity is a class used by activity authors to express new behaviors declaratively in terms of other NativeActivity, CodeActivity, AsyncCodeActivity, or DynamicActivity objects, whether they are custom-developed or included in the .NET Framework 4 Built-In Activity Library.

Rich Composite Activity Options

Flowchart is a powerful new control flow activity that allows authors to model arbitrary loops and conditional branching. Flowchart provides an event-driven programming model that was previously only able to be implemented with StateMachineWorkflowActivity. Procedural workflows benefit from new flow-control activities that model traditional flow-control structures, such as TryCatch and Switch.

Expanded Built-In Activity Library

New features of the activity library include:

Explicit Activity Data Model

.NET Framework 4 includes new options for storing or moving data. Data can be stored in an activity using Variable. When moving data in and out of an activity, specialized argument types are used to determine which direction data is moving. These types are InArgument, InOutArgument, and OutArgument. For more information, seeWindows Workflow Foundation Data Model.

Enhanced Hosting, Persistence, and Tracking Options

.NET Framework 4 contains persistence enhancements such as the following:

Easier Ability to Extend WF Designer Experience

The new WF Designer is built on Windows Presentation Foundation (WPF) and provides an easier model to use when rehosting the WF Designer outside of Visual Studio and also provides easier mechanisms for creating custom activity designers. For more information, seeCustomizing the Workflow Design Experience.

State Machine Workflows

State machine functionality in Windows Workflow Foundation (WF) was introduced subsequent to the release of .NET Framework 4 as part of the Update 4.0.1 for Microsoft .NET Framework 4 (KB2478063). The StateMachine activity in this update allows you to create workflows using the familiar state machine paradigm. To create state machine workflow applications in Visual Studio 2010, the Update 4.0.1 for Microsoft .NET Framework 4 – Design-time Package for Visual Studio 2010 SP1 (KB2495593) is required. For more information and instructions on how to download and configure these updates, see Update 4.0.1 for Microsoft .NET Framework 4 Features. For information on creating state machine workflow applications, see How to: Create a State Machine Workflow, Windows Workflow Foundation (WF4) - Introduction to State Machine Hands On Lab, and .NET Framework 4 Platform Update 1 State Machine Workflows.