Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Preface

Preface

Windows Workflow Foundation (WF) is a technology for defining, executing, and managing workflows. It is part of the .NET Framework 3.0 and will be available natively in the Windows Vista operating system.

Windows Workflow Foundation might be the most significant piece of middleware to arrive on the Windows platform since COM+ and the Distributed Transaction Coordinator. The difference is, not every application needs a distributed transaction, but nearly every application does have a workflow encoded inside.

This book will help you add that workflow power to your applications.

What This Book Covers

Chapter 1 introduces us to the concept of workflow and describes how Windows Workflow can solve the difficult problems inherent in workflow solutions. We'll become familiar with activities as the basic building blocks of a workflow definition and demonstrate how to author a simple workflow using Visual Studio 2005. This chapter also describes the runtime services available with WF. By the end of the chapter we will be able to identify the primary features of Windows Workflow.

Chapter 2 concentrates on authoring workflows. Specifically, we'll look at how to build workflows with C#, and with extensible application markup language (XAML). Looking at the workflow compiler, we'll have a better understanding of how WF uses code generation to produce classes from workflow markup, and how this generated code can combine with our hand‑written code to produce a workflow type. This chapter will provide the fundamental knowledge needed to understand how WF operates during the compilation phase.

In Chapter 3, we will turn our attention to sequential workflows. We will examine the SequenceActivity and learn about the events fired by the workflow runtime during the life of a workflow instance. Using Visual Studio, we will build workflows that accept parameters and communicate with a host process by invoking methods and listening for events. The chapter concludes with a workflow example that raises an exception and uses a fault handler.

Chapter 4 examines each activity in the WF base activity library. We will look at the control flow activities, communication activities, and transaction-oriented activities. The chapter also examines web service activities, rule-centric activities, and state activities. The goal of this chapter is to make us aware of all the capabilities provided by the base activity library, with an eye towards understanding how each activity can solve a particular problem.

With an understanding of what is available in the base activity library, we can look at building our own custom activities in Chapter 5. This chapter examines the motivations for building custom activities, and provides examples of building a custom activity using both a compositional approach and a derivation approach. We'll see how to build a custom validator and designer for our activity, and also understand the advantages of using dependency properties. The chapter ends by covering the execution context, which we must understand to build robust activities.

Chapter 6 covers the workflow runtime, workflow diagnostics, and the out‑of‑the‑box services provided for WF by Microsoft. The chapter demonstrates how to configure services both declaratively and programmatically. We'll see examples of how to use a scheduling service, persistence service, and tracking service. The chapter provides enough information to allow a developer to select and configure the services needed for a wide variety of scenarios and environments.

Chapter 7 focuses on building event‑driven workflows using state machines. We'll see how WF models the traditional state machine using activities, and we will build a workflow to handle external events and react with state transitions. We'll also see how to track and examine the history of state machine execution. The chapter ends with an examination of a hierarchical state machine, which provides all the knowledge we need to tackle tough problems with event‑driven workflows.

Chapter 8 is dedicated to workflow communications. The chapter explains how to use correlated local services for communication with a host process, and web service activities for communication across a network. By the end of the chapter we'll uncover the queuing service that is used behind the scenes of a workflow to coordinate and deliver messages.

Finally, Chapter 9 is about rules and conditions in Windows Workflow. This discusses the role of business rules in software development and provides examples of how WF's rules engine can take away some of the burden of rule development. The chapter takes an in-depth look at rule execution in the PolicyActivity, and recording diagnostic information about rule evaluation. We'll come away with the knowledge we need to build rule‑based solutions using Windows Workflow.

What You Need for This Book

Windows Workflow Foundation is one part of the .NET 3.0 framework. To run Windows Workflow, you'll need to download and install the .NET 3.0 redistributable (see the links below):

.NET 3.0 (x86): http://go.microsoft.com/fwlink/?LinkID=70848

.NET 3.0 (x64): http://go.microsoft.com/fwlink/?LinkID=70849

Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation):

http://www.microsoft.com/downloads/details.aspx?FamilyId= 5D61409E-1FA3-48CF-8023-E8F38E709BA6&displaylang=en

The .NET 3.0 runtime requires Windows Server 2003 SP1, Windows XP SP2, or Windows Vista. To develop Windows Workflow solutions you'll need to download the Visual Studio 2005 extensions for .NET Framework 3.0.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

There are three styles for code. Code words in text are shown as follows:

"The codeActivity1_ExecuteCode method is here and waiting for us to provide an implementation"

A block of code will be set as follows:

using System;
using System.Workflow.Activities;
namespace chapter2_library
{
public sealed partial class PureCode: SequentialWorkflowActivity

{
public PureCode()
{
InitializeComponent();
}
}
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:

using System;
using System.Workflow.Activities;
namespace chapter2_library
{
public sealed partial class PureCode: SequentialWorkflowActivity
{
public PureCode()
{
InitializeComponent();
}
}
}

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "Right-click the workflow and select the Delete option".

Warnings or important notes appear in a box like this.


Tips and tricks appear like this.


Reader Feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to feedback@packtpub.com, making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email suggest@packtpub.com.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer Support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the Example Code for the Book

Visit http://www.packtpub.com/support, and select this book from the list of titles to download any example code or extra resources for this book. The files available for download will then be displayed.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata have been verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Questions

You can contact us at questions@packtpub.com if you are having a problem with some aspect of the book, and we will do our best to address it.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint