ur daily lives revolve around a series of activities, decisions, and rules. For example, upon waking one of the first activities you do is probably to brush your teeth, followed by washing your face, etc. You have to make decisions, such as what to eat for breakfast and which tie to wear to work. And there are always rules to observe, such as a certain time to arrive at the office, etc. All these activities, decisions, and rules are known as workflows
Workflows exist everywhere, and the programming world is no exception. Take the case of a simple purchase-order application: the user enters the purchase amount for approval and the approval is routed to his immediate superior. If the amount exceeds a certain figure, approval from higher authority needs to be sought. And if the approval party is currently unavailable, the approval process is suspended until the superior returns and grants the approval.
In the traditional programming paradigm (such as using C# and Visual Basic), you would implement the series above imperatively. That is, you supply a series of instructions describing how to perform a task and how to transition from one task to another. However, a better approach is to declaratively describe the series of tasks and implement each task independently of others. And this is the role of the Windows Workflow Foundation (Windows WF). By declaratively describing the series of tasks, you can then easily change the application logic without affecting the individual components that made up a task. For example, you may have a loan approval system that involves several approving parties. Using Windows WF, you can easily change the rules of the approval process without affecting the software components for each individual party.
Windows Workflow Foundation provides the framework for building workflow-enabled applications on Windows. The workflow can then be hosted in environments such as Windows, Windows Presentation Foundation (WPF), and ASP.NET applications.
In this article, I will introduce you to the basics of Windows Workflow Foundation and how you can build workflow-enabled applications using Visual Studio 2005. As Windows Workflow Foundation is suited for large-scale projects, the samples described in this article do not necessarily conform to best practices. My primary aim is to get you started in Windows Workflow Foundation.