WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Windows Workflow Foundation provides a simplified programming model, an in-process workflow engine and improved designer that can be used to design and implement workflows in .NET applications. This article discusses the new features in Windows Workflow Foundation 4 and shows how you can get started with it using Microsoft Visual Studio 2010 IDE.
To execute the code examples illustrated in this article, you should have Microsoft Visual Studio 2010 installed in your system.
Business Process, Workflow, Windows Workflow Foundation
A business process is a collection of activities that have a common objective. The Wikipedia states: "A business process or business method is a collection of related, structured activities or tasks that produce a specific service or product (serve a particular goal) for a particular customer or customers. It often can be visualized with a flowchart as a sequence of activities." Reference: http://en.wikipedia.org/wiki/Business_process
Microsoft' Windows Workflow Foundation is a framework that can be used to create, manage and execute workflows. A Workflow in the context of Windows Workflow Foundation may be defined as a tool that is used to model the flow of data and activities that relate to the actions to be performed on the data. According to the Workflow Management Coalition, workflow is defined as the "automation of a business process, in whole or part, during which documents, information, or tasks are passed from one participant to another for action, according to a set of procedural rules."
Reference: www.wfmc.org/ .
Workflows are a good choice for any application that has one or more long running process. Workflows enable you to change behaviour without much change in the application's code. For applications that thrive on business rules that can change over a period of time, workflows are a great choice.
A Workflow Management System (commonly known as WFMS) is software that manages workflow execution, by interpreting the process definition, interacting with workflow participants and, where required, invoking external IT tools and applications. Note that all workflow systems are process oriented.
Workflow Management Systems have two basic components: the workflow modeling component and the workflow execution component. While the former can be used to model workflows using a visual designer, the later is used to execute and manage your workflows.
Benefits of Workflow
Automating workflows provides a lot of benefits - these include:
- Reduced operating cost
- Increased efficiency
- Better flexibility, adaptability and control
Types of Workflow
Windows Workflow Foundation 4 supports the following types of Workflow:
- Sequential - This is a type of Workflow in which the actions are executed in a predefined sequence. A typical example of a sequential Workflow is the sequence of steps needed to connect to a database in ADO.NET Entity Framework
- State Machine - This is a type of Workflow in which there aren't any predefined sequence. Rather, the Workflow is represented using states and the transitions between such states. Note that State Machine workflows are no longer supported by Windows Workflow 4
Architectural Components of Windows Workflow Foundation
The major architectural components of Windows Workflow Foundation include:
- Base Activity Library - This comprises of a collection of base classes, activities, etc. These base classes can be extended to create custom activities.
- Runtime Engine - This is the component that provides support for managing and executing workflows.
- Runtime Services - This is the component that provides support for hosting workflows.
New Features in Windows Workflow Foundation 4
Windows Workflow Foundation is a Microsoft framework that can be used to create, manage and execute workflows in a managed environment. Windows Workflow 4 is available as part of .NET Framework 4.0 and ships with Microsoft Visual Studio 2010. The most important feature of Windows Workflow 4 is its ability to be tightly integrate with Windows Communication Foundation. Windows Workflow Foundation 4 is more or less a complete rewrite of the Workflow library. It uses XAML to define workflows and runs on top of .NET Framework 4.0. The other major enhancements to Windows Workflow 4 include:
- State Machine Workflows are no longer supported - With WF 4, you no longer have support for creating state machine workflows.
- Excellent integration with Windows Communication Foundation 4 - There has been significant improvements to WCF and WF in .NET Framework 4. New features added in WF 4 for improved integration with WCF applications include: message correlation, better support for hosting, etc.
- Support for Extended Base Class Library - Windows Workflow Foundation 4 now contains an Extended Base Class Library that contains a list of new activities added. These activities include: Flowchart, ForEach, DoWhile, Break (in the Flowchart group) and Send, Receive, SendReceive, RecieveParameters, CorrelationScope, InitializeCorrelation (in the WCF group).
- Simplified Programming Model - With Window Workflow 4, creating, hosting, managing and executing workflows have been made much simpler.
- Designer improvements - The Workflow designer has been improved a lot in WF 4. You can now create, manage and execute much complex workflows with no degradation in performance.