learnWorkflow: 3.5 chapter overview





chapter overview

The material in this book is a WF tutorial presented in 19 chapters, with each chapter building upon the ones before it. I’ve tried to organize the material so that you don’t have to jump ahead in order to understand how something works. But since the chapters build upon each other, I do assume that you have read each chapter in order and understand the material that has already been presented.

The short sections that follow provide a brief summary of each chapter.

chapter 1: a quick tour of windows workflow foundation

This chapter provides a brief introduction to WF. In this chapter, you jump right in and develop your first workflow (“Hello Workflow”). You are introduced to some of the fundamental concepts of WF, such as how to pass parameters to a workflow and how to make decisions within a workflow.

chapter 2: foundation overview

The goal of this chapter is to provide a high-level overview of WF in its entirety. This chapter doesn’t teach you how to use each individual WF feature, but it does acquaint you with the design time and runtime features that are available with WF. This chapter is a roadmap for the material that is covered in the remainder of the book.

chapter 3: activities

Activities are the building blocks of WF and are used to construct complete workflows. This chapter provides a summary of the standard activities that are distributed with WF. This chapter also contrasts two ways to introduce business logic into a workflow: the CodeActivity and building your own custom activities.

chapter 4: hosting the workflow runtime

WF is not a stand-alone application. It is a framework for building your own workflow-enabled applications. This chapter demonstrates how to host the workflow runtime in your own application. Included in this chapter is a set of custom workflow manager classes that assist with hosting of the workflow runtime. These helper classes are used in most of the chapters that follow this one.

chapter 5: flow control

WF includes a rich set of standard activities that support everything from simple branching decisions and while loops to parallel execution and replication. These flow control activities control the execution sequence within a workflow and are covered in this chapter. Most of these activities support Boolean conditions that can be specified in code or as declarative rule conditions. These two types of conditions are contrasted in this chapter.

chapter 6: local services

Several core features of WF are implemented as pluggable services. This allows you to choose the implementation of each service that meets your needs. WF also provides for local services that can be implemented by you to serve any purpose. One common use of local services is to facilitate communication between workflow instances and your host application. The focus of this chapter is on implementing and using your own local services.

chapter 7: event-driven activities

This chapter covers event-driven activities that allow your workflows to wait for the receipt of an external event. Chapter 6 shows you how to implement local services and invoke methods of those services from workflow instances. This chapter demonstrates how to raise events from those local services and handle the events within a workflow. This chapter also discusses the development of custom event-driven activities and the use of workflow queues for communication.

chapter 8: workflow persistence

Workflow persistence allows you to automatically save the state of running workflow instances and then reload them at a later time. The use of persistence is especially important for long-running workflows where a workflow can be unloaded from memory while it is idle and waiting for an external event.

chapter 9: state machine workflows

WF supports two main types of workflows: sequential and state machine. Up until this point in the book, you have been working with sequential workflows that target system interaction problems. Sequential workflows are best used when the exact sequence of tasks is known at design time. State machine workflows are the focus of this chapter and are designed to easily react to external events. They are especially useful for problems that involve human interaction since the exact sequence of tasks can’t be determined at design time.

chapter 10: transactions and compensation

The goal of this chapter is to demonstrate two ways to control the integrity and consistency of work that is performed by a workflow. Transactions allow you to enlist multiple activities into a single logical unit of work. When transactions are used, all of the work is committed or rolled back together without any partial updates. On the other hand, compensation is the process of undoing work that has already completed. Compensation might be necessary if individual activities in a workflow have completed successfully, but later the workflow determines that the work must be undone.

chapter 11: workflow rules

WF includes a general-purpose rules engine that you can also use as an alternate way to declare your business logic. Rules are best thought of as simple statements or assertions about data and not as procedural instructions. Individual rules are grouped into rule sets and are evaluated by the rules engine that is included with WF. Each rule allows you to define the actions to execute when the rule evaluates to true, and a separate set of actions when it is false.

chapter 12: exception and error handling

Exception handling is important in any application, and WF provides a way to declaratively handle exceptions. The goal of this chapter is to demonstrate various ways to handle exceptions within the workflow model. This chapter also covers cancellation handlers that are used to execute a set of activities when an executing activity is canceled.

chapter 13: advanced custom activities

This chapter provides additional information concerning the development of custom activities. The development of general-purpose composite activities is explored, along with guidelines for the development of long-running activities.

chapter 14: dynamic workflow updates

Most of the time, you will statically define a workflow and then create instances of it at runtime. WF also provides the ability to dynamically apply updates to an executing workflow, altering the internal structure of the workflow. This chapter demonstrates how to apply dynamic workflow updates from the host application, as well as from within an executing workflow.

chapter 15: workflow tracking

WF provides an instrumentation framework for tracking the execution of each workflow. The tracking framework supports pluggable tracking services that you can implement to meet your needs. The framework is based on tracking profiles that allow you to customize the amount and type of data tracked for each workflow type. The focus of this chapter is using the standard tracking service and also developing your own custom tracking service.

chapter 16: web services and ASP.NET

WF allows you to declaratively access web services from within a workflow. You can also expose a workflow as a web service that can be accessed by any web service client. These topics are covered in this chapter along with the use of WF from an ASP.NET Web Forms application.

chapter 17: workflow services and wcf integration

The focus of this chapter is the new .NET Framework 3.5 support for WCF and WF integration. The primary example of this integration is the ability to host WCF services that are implemented as workflows. This is known as workflow services. Starting with .NET 3.5, WF also enables you to directly invoke a WCF service from within a workflow.

chapter 18: workflow serialization and markup

The goal of this chapter is to demonstrate the use of workflow markup and serialization. Each workflow definition can be declared and expressed in several forms, including markup. Markup declares a workflow in a simple XML form that doesn’t require compilation and can be parsed and executed directly by the workflow runtime engine. The advantage of using markup is that it is much easier to modify the workflow definition outside of Visual Studio, since it doesn’t require compilation.

chapter 19: hosting the workflow designers

After workflow serialization and markup is presented in Chapter 18, this chapter shows you how to build your own workflow designer. WF includes the classes that you need to host the workflow designers in your own application. The bulk of this chapter presents a working designer application that enables you to define and modify markup-only workflows.