Windows Workflow Foundation

Windows Workflow Foundation (WF) is a Microsoft technology for defining, executing, and managing workflows. This technology was first released in November 2006 as a part of .NET Framework 3.0. Workflows, like traditional programs, allow you to coordinate work but have some important differences.

  • Workflows can handle long running work by persisting to a durable store, such as a database, when idle and loading again once there is work to do
  • An instance of a workflow can be modified dynamically while running in the event that new conditions require the workflow to behave differently from the way it did when it was created
  • Workflows are a declarative way of writing programs by linking together pre-defined activities rather than an imperative programming model of writing lines of code
  • Workflows allow you to declare business rules that are separated from your code making it easier for you to modify them in the future Workflows support different styles of systems with sequential and state machine workflows

A new XML-based language called XAML is commonly used for declaring the structure of a workflow. However, the workflow may also be expressed in code using any .NET-targeted language (VB.NET, C#, C++/CLI, etc.). WF provides .NET developers with the ability to separate the logic of their application from the underlying execution components, thus providing a clearer, more manageable representation of the application. This approach lends credence to the growing process-driven application methodology which aims to separate an application's logical flow from its executable components at an enterprise level.

Workflows comprise 'activities'. Developers can write their own domain-specific activities and then use them in workflows. WF also provides a set of general-purpose 'activities' that cover several control flow constructs.

Windows Workflow Foundation is supported by a companion set of extensions to Visual Studio 2005. These extensions contain a visual workflow designer which allows users to design workflows, a visual debugger which enables the users to debug the workflow designed, and a project system which enables the user to compile their workflows inside Visual Studio 2005. In Visual Studio 2008 WF functionality is included.

The .NET Framework 3.0 "workflow runtime" provides common facilities for running and managing the workflows and can be hosted in any CLR application domain, be it a Windows Service, a Console, GUI or Web Application.

Using the WF foundation, three different types of Workflow can be created: Sequential Workflow (Typically Flow Chart based, progresses from one stage to next and does not step back) .State Machine Workflow (Progress from 'State' to 'State', these workflows are more complex and return to a previous point if required) . Rules-driven Workflow (Implemented based on Sequential/StateMachine workflow. The rules dictate the progress of the workflow)

Workflow is not an application, but instead a set of actions that is executed asynchronously by the engine provided by Windows WF. That's the key to being able to use a workflow in such a variety of scenarios. The interface that allows communication between that engine and the executing process is called the Hosting Layer, which provides some extra services apart from Communication (send an receive events and data from and to the workflow), like Persistence (which allows saving the state of the workflow in a storage media to restore it later) or Tracking (so the actual code running the workflow can log the execution of it). Finally, the Runtime Layer, which actually executes the workflow and manages the core services. One different with the other two layers is that Runtime Layer is not extensible, while more services can be added to the Hosting Service.

Apart from these layers, Windows WF comes with an integrated designer that by default integrates smoothly in Visual Studio 2005 or above, but which can be used outside it, so any developer could add drag-and-drop support to its own application.

What is a Workflow ?

A set of activities that coordinate people and/ or software.

Workflows are a set of Activities. Worlflows run within a Host Process. Host Process means any of your application or server. Developers can build their own Custom Activity Libaries.

Base Activity Library: Out-of-box activities and base for custom activities.
Runtime Engine: Workflow execution and state management.
Runtime Services: Hosting flexibility and communication.
Visual Designer: Graphical and code based construction.

To illustrate how this would be useful in an ASP.NET application, consider a help desk ticket workflow scenario. A business user starts the workflow by filling out an ASP.NET Web form and clicking a submit button. Next, a server notifies a help desk employee using a Windows Forms application that a new ticket is available. The help desk employee would then work on the problem, and eventually close the ticket. If this workflow scenario were developed using Windows WF, all the process logic and flow could be contained in the workflow itself, and the ASP.NET application would need to know nothing about the logic.

Combining ASP.NET 2.0 and Windows Workflow Foundation (WF) will provide us with all the essential tools for building workflow-enabled web applications. Both ASP.NET and WF, however, are significant pieces of technology. Joining the two into a long-term relationship requires some careful thought and planning.

With WF, we have gained transparency in the sense that any developer, or even business person, can look at our workflow model in the workflow designer see how an order moves from Open to Completed. We have a UI that is driven by this model, and that will prevent users from accidently shipping a processed order.

Easy Step by Step Series of Video Tutorials for WWF (Windows Workflow Foundation, .Net Framework 3.0+)

So Lets Get Started with WWF Concepts in Visual Studio.Net, easy to understand Webcast series.

blogspot stats