Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

.NET

Windows Workflow Foundation--What's That?


Windows Workflow Foundation (WF) is one of the three pillars in the WinFX library-the new face of the Windows SDK to be released with Windows Vista later this year. The other two constituent parts of the new Windows SDK are Windows Communication Foundation (WCF), formerly known as Indigo, and Windows Presentation Foundation (WPF) formerly codenamed Avalon.

WF is an extensible framework for developing workflow solutions running on the Windows .NET platform. It provides a unified model to create workflow solutions where each step is said to be an "activity." Like controls in a Windows Forms or ASP.NET application, an activity expresses a well-known behavior, and along with the all other constituent activities, describes the semantics of the workflow. An activity is connected to the rest of the system either sequentially (sequential workflow) or through transition states (state-machine workflow). Speaking in programming terms, an activity is a component that codes a behavior, sports an object model (typically, properties and events) and is backed up by .NET code.

Architecturally speaking, WF provides a workflow engine, a .NET managed API, and a visual designer and debugger integrated with Visual Studio 2005. Just as you create your Web pages visually in a tailor-made environment, you compose the steps of your specific workflow in a visual designer and add code-behind workflow components to implement rules and define the business process.

A WF workflow is made of two files-a collection of activities and a code-behind source file. The activity file can be persisted in either of two ways-using an XML-like language called XOML or using a designer class file. The former approach looks like ASP.NET pages, where you have a markup file (the .aspx file) and a code-behind class written in Visual Basic .NET or C#. The latter approach resembles that of Windows Forms, where you have a form's designer class file (for example, form1.designer.vb) to express the structure of the form using auto-generated code and a code-behind class to incorporate the user-defined logic for the form.

By default, the designer approach is used, but you ultimately choose the preferred style by picking up a different item from the list of new items that can be added to a workflow Visual Studio 2005 project. In terms of performance, there's no difference at all between the two models.

The workflow is compiled to an assembly and deployed as any other assembly in a .NET application-in the Bin folder or in the Global Assembly Cache.

In order to invoke workflows, client applications need to first create (or obtain) an instance of the workflow runtime. Exactly one copy of the workflow runtime is allowed per AppDomain. The runtime takes "messages" from the outside world regarding the workflow types to instantiate and manage. You never instantiate a workflow directly using the new operator. Instead, you send a sort of message to the runtime asking it to create and activate an instance of a given workflow type. The lifetime of the workflow is entirely managed by the runtime. In Windows Forms applications, you create the workflow runtime manually in the startup of the application; in Web applications, you obtain the workflow runtime instance to use directly from a HTTP module that must be registered in the web.config file.

Other than managing the lifetime of workflow instances, the workflow runtime provides rich services, including automatic program persistence, thread scheduling, compensating transactions, and runtime inspection and monitoring of program state. Of particular importance are the persistence and the thread scheduling services. The former allows the runtime to remove from memory a workflow that is idle waiting for user input. The workflow is serialized to a storage medium and resumed on demand when the awaited input arrives. The latter is key in ASP.NET to ensure that the results of the workflow are ready before the page renders out so that the page can incorporate and show them to the user.

Fully integrated with Office 12 and SharePoint 2007, WF is the ultimate workflow API for the Windows and .NET 2.0 platform. Future versions of Microsoft flagship products will incorporate workflow capabilities through this API and most third-party vendors are going to update their products on top of WF. That's the way to go, as far as workflow applications on the Windows platform are concerned.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.