Rediger

Del via


What's New in Windows Workflow Foundation

Windows Workflow Foundation (WF) in .NET Framework 4 changes several development paradigms from previous versions. Workflows are now easier to create, execute, and maintain, and implement a host of new functionality. For more information about migrating .NET Framework 3.0 and .NET Framework 3.5 workflow applications to use the latest version, see Migration Guidance.

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 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<T>.

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, see Windows 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, see Customizing the Workflow Design Experience.