The inaugural installment of Beginning Windows Workflow Foundation development demonstrated how to use this .NET
Framework 3.0 tool to create, manage, modify and run workflows. This tip takes a closer look at tracking services within a workflow, setting rules and conditions for a workflow and making the most of the runtime's Base Class Library.
Along with our aforementioned tip, a good starting point for some introductory information is Microsoft's Hands-on Labs for Windows Workflow Foundation. This set of 10 one-hour labs, aimed at developers with at least six months of .NET programming experience, walks developers through the process of creating workflow-enabled Windows applications. Downloads are available for Visual Basic and C#.
Additional help with bringing workflow into ASP.NET applications is available in the Windows Workflow Foundation Web Workflow Approvals Starter Kit. This kit shows developers how to automate work order requests; there are separate, pre-defined roles for creating, approving and monitoring these workflows and the events within them.
One key to the success of a workflow is the ability to track events. (Think of the "human" workflow at a sandwich shop. It's much easier to determine the whereabouts of a missing order when wielding a receipt adorned with an order number.)
Enter Tracking Services in Windows Workflow Foundation, a recent MSDN article that explains the framework's tracking architecture. Workflow events are tracked through the use of tracking profiles, which can be created directly in XML or through an object model. As author Matt Milner puts it:
A tracking profile is essentially a collection of track points. Each track point correlates to the types of events that can be tracked, providing information to the runtime about when to extract data and what data to extract….A track point contains one or more tracking locations, which actually define where and when to track the data.
Milner also provides some guidance regarding Windows Workflow Foundation's SQL tracker, which sends tracking profiles to SQL Server and lets programmers search for the tracking information they so desire without writing SQL queries. There are also a few tidbits of advice on creating custom tracking services. For these to succeed, Milner said, you need to first determine how tracking profiles will be created and then implement a tracking service and a tracking channel.
Finally, we offer a series of articles from K. Scott Allen, author of the blog OdetoCode.com and Packt Publishing's Programming Windows Workflow Foundation. These offer a handy introduction to the concept of workflow, how it works and what must be done to make it work.
- Hello, Workflow: This article describes the essence of a workflow, using the example of a pizza shop (these examples always seem to involve food), and offers a bird's-eye view of Windows Workflow Foundation, XAML and how it comes together in Visual Studio.
- State Machines in Windows Workflow Foundation: This article introduces the state machine type of workflow, which relies on external events to shape how it, well, flows, and then covers the process of creating such a workflow.
- The Base Activity Library: Here, as you may guess, Allen peers into the vast list of activities provided in Windows Workflow Foundation.
- Authoring Workflows: Here Allen presents a programmer's options for coding a workflow, as opposed to playing with drag and drop. "We can author workflows using a purely declarative style (XAML), a purely imperative style (C# or VB.NET code), or a combination of XAML and code," he notes.
- Rules and Conditions: This article talks about how to apply rules and conditions to a workflow/
- Hosting Windows Workflow Foundation: Since WF is really a runtime and not an application, it is worth considering how to host that which utilizes the runtime. In this article Allen looks at the services available in that runtime and how they are scheduled, tracked and run.
As always, if you have Windows Workflow Foundation resources to share, send them along and we will add them to this tip.