Contents

About the Author

About the Technical Reviewers

Acknowledgments

Introduction


imagesChapter 1: A Quick Tour of Windows Workflow Foundation

Why Workflow?

Workflows Are Different

Why Windows Workflow Foundation?

Your Development Environment

The Workflow Workflow

Hello Workflow

Creating the Project

Declaring the Workflow

Adding the Sequence Activity

Adding the WriteLine Activity

Hosting the Workflow

Running the Application

Exploring the Xaml

Passing Parameters

Declaring the Workflow

Hosting the Workflow

Running the Application

Using Argument Properties

Making Decisions

Creating the Project

Implementing a Custom Activity

Defining Arguments

Defining Variables

Adding the Custom Activity

Adding the Switch<T> and Assign Activities

Hosting the Workflow

Running the Application

Debugging the Application

Unit Testing

Testing the Custom Activity

Testing the Workflow

Summary

imagesChapter 2: Foundation Overview

WF Features and Capabilities

Declarative Activity Model

Standard Activities

Custom Activities

Workflow Designer

Custom Activity Designers and Validation

Multiple Modeling Styles

Workflow Debugger

Workflow Services

Multiple Workflow Hosts

Workflow Extensions

Persistence

Bookmark Processing

Expressions

Transaction Support

Compensation and Exception Handling

Workflow Tracking

Designer Rehosting

WF 3.x Migration

Assemblies and Namespaces

System.Activities

System.Activities.DurableInstancing

System.Runtime.DurableInstancing

System.Activities.Presentation

System.ServiceModel.Activities

3.x Assemblies

Activity Life Cycle

Definition vs. Runtime Instance

Definition vs. Runtime Variables

Activity States

Expressions

Visual Basic Expressions

VB Primer for Workflow Developers

Expression Activities

Missing 4 Features

State Machine

Reuse of WCF Contracts

C# Expression Support

Tracking to SQL Server

Rules Engine

Dynamic Updates

Summary

imagesChapter 3: Activities

Understanding Activities

Authoring Activities

Kinds of Work

Kinds of Data

Activity Class Hierarchy

Custom Activity Workflow

An Example Activity

Implementing an Activity in Code

Creating the Project

Implementing the Activity

Implementing Unit Tests

Testing the Activity

Declaring an Activity with Xaml

Creating the Activity Class

Defining Arguments

Defining Variables

Declaring the Activity

Implementing Unit Tests

Testing the Activity

Declaring an Activity with Code

Creating the Activity Class

Implementing the Activity

Implementing Unit Tests

Testing the Activity

Implementing an Asynchronous Activity

Creating the Activity Class

Implementing the Activity

Implementing Unit Tests

Testing the Activity

Using Activities

Workflow Building Blocks

Activity Data Flow

Variable Scoping

Standard Activities Summary

Standard Activities

Control Flow

Flowchart

Messaging

Runtime

Primitives

Transactions and Compensation

Collection Management

Error Handling

Migration

Summary

imagesChapter 4: Workflow Hosting

Understanding the WorkflowInvoker Class

Using the Static Methods

Using the Instance Methods

Using the WorkflowInvoker Static Methods

Declaring the HostingDemoWorkflow

Simple Hosting of the Workflow

Passing Arguments with Workflow Properties

Declaring a Timeout Value

Invoking a Generic Activity

Using the WorkflowInvoker Instance Methods

Using the InvokeAsync Method

Using the BeginInvoke Method

Understand the WorkflowApplication Class

Constructing a WorkflowApplication

Assigning Code to Delegate Members

Managing Extensions

Configuring and Managing Persistence

Executing a Workflow Instance

Managing Bookmarks

Manually Controlling a Workflow Instance

Using the WorkflowApplication Class

Hosting the Workflow with WorkflowApplication

Canceling a Workflow Instance

Aborting a WorkflowInstance

Terminating a WorkflowInstance

Using the BeginRun Method

Understanding the ActivityXamlServices Class

Using the ActivityXamlServices Class

Invoke Workflows from ASP.NET

Designing the ASP.NET Application

Hosting the Workflow

Testing the Application

Managing Multiple Workflow Instances

Implementing a Workflow Manager

Implementing the InstanceInfo Class

Designing the User Interface

Implementing the User Interface Code

Testing the Application

Using the WPF SynchronizationContext

Summary

imagesChapter 5: Procedural Flow Control

Understanding the Procedural Modeling Style

Making Decisions

Understanding the If Activity

Understanding the Switch<T> Activity

Understanding the While and DoWhile Activities

Using the While and DoWhile Activities

Implementing the InventoryLookup Activity

Declaring the GetItemInventory Workflow

Hosting the Workflow

Testing the Workflow

Using the DoWhile Activity

Understanding the Parallel Activity

Understanding Parallel Execution

Creating the ParallelDemo Project

Declaring the ParallelDemo Workflow

Hosting the Workflow

Testing the Workflow

Adding a Delay Activity

Testing the Revised Workflow

Using the Parallel Activity

Creating the GetItemLocation Project

Declaring the GetItemLocation Workflow

Hosting the Workflow

Testing the Workflow

Obtaining Asynchronous Execution with the Parallel Activity

Implementing the InventoryLookupAsync Activity

Modifying the GetItemLocation Workflow

Testing the Revised Workflow

Summary

imagesChapter 6: Collection-Related Activities

Understanding the ForEach<T> Activity

Understanding the Collection Activities

Using the ForEach<T> and Collection Activities

Creating the ActivityLibrary Project

Implementing Item Structures

Implementing the FindInCollection<T> Activity

Declaring the InventoryUpdate Workflow

Hosting the Workflow

Testing the Workflow

Using the ParallelForEach<T> Activity

Testing the Revised Workflow

Working with Dictionaries

Implementing the Dictionary-Related Activities

Declaring the InventoryUpdateDictionary Workflow

Hosting the Workflow

Testing the Workflow

Understanding the InvokeMethod Activity

Using the InvokeMethod Activity

Revising the ItemInventory Class

Modifying the Workflow

Testing the Workflow

Summary

imagesChapter 7: Flowchart Modeling Style

Understanding the Flowchart Modeling Style

Using the Flowchart Modeling Style

Flowchart Activity

FlowDecision Activity

FlowSwitch<T> Activity

FlowStep Activity

Putting It All Together

The Flowchart Workflow

Making Simple Decisions

Implementing the ParseCalculatorArgs Activity

Creating the Console Project

Defining Arguments and Variables

Declaring the Workflow

Hosting the Workflow

Testing the Workflow

Declaring Looping Behavior

Implementing the InventoryLookup Activity

Creating the Console Project

Defining Arguments and Variables

Declaring the Workflow

Hosting the Workflow

Testing the Workflow

Declaring Custom Activities

Defining Arguments and Variables

Declaring the Activity

Implementing Unit Tests

Testing the Activity

Mixing the Two Styles

Implementing Item Structures

Implementing the FindInCollection<T> Activity

Creating the Console Project

Defining Arguments and Variables

Declaring the Workflow

Hosting the Workflow

Testing the Workflow

Summary

imagesChapter 8: Host Communication

The Need for Long-Running Workflows

Understanding Bookmarks

Using Bookmarks

Implementing the GetString Activity

Implementing the ParseCalculatorArgs Activity

Creating the Console Project

Hosting the Workflow

Testing the Workflow

Understanding Workflow Extensions

Using Workflow Extensions

Declaring the Extension Interface

Implementing the HostEventNotifier Extension

Implementing the NotifyHost Activity

Declaring the BookmarkCalculatorExtension Workflow

Hosting the Workflow

Testing the Workflow

Using an Alternate Extension

Implementing the HostQueueNotifier Extension

Hosting the Workflow

Testing the Workflow

Understanding the ActivityAction

Using the ActivityAction

Implementing the NotifyHostWithAction Activity

Declaring the BookmarkCalculatorAction Workflow

Binding the Action Property

Hosting the Workflow

Testing the Workflow

Using the InvokeAction Activity

Understanding the Pick Activity

Using the Pick Activity

Implementing the WaitForBookmark Activity

Creating the Console Project

Defining Variables

Declaring the ProblemReporting Workflow

Hosting the Workflow

Testing the Workflow

Summary

imagesChapter 9: Workflow Services

Introducing Workflow Services

Understanding WCF

Defining Service Contracts

Configuring Endpoints and Bindings

Hosting and Configuration

Understanding Workflow Services

Messaging Activities

Service Contracts and Message Types

Correlation

Declaration and Hosting Options

Controlling Workflow Service Instances

Declaring a Workflow Service

Tasks for a Request/Response Operation

Implementing the OrderProcessing Workflow Service

Creating the ServiceLibrary Project

Implementing Request and Response Classes

Declaring the Service Operation

Populating the Response

Configuring the Service

Testing the Service

Publishing a Workflow Service to IIS

Enhancing the Web.config

Publishing to IIS

Implementing a Client Application

Adding a Service Reference

Invoking the Service

Reviewing the Configuration

Testing the Client Application

Implementing a Workflow Client

Implementing Custom Activities

Adding a Service Reference

Implementing the InitiateOrderProcessing Workflow

Hosting the Workflow

Testing the Client Application

Self-hosting the Workflow Service

Understanding the WorkflowServiceHost

Tasks for Self-hosting a Service

Implementing the ServiceHost Application

Configuring the Service Host

Testing the Self-hosted Service

Using the WorkflowClient Application

Summary

imagesChapter 10: Workflow Services Advanced Topics

Using Context-Based Correlation

Guidelines for Context-Based Correlation

Declaring the ShipOrder Workflow Service

Modifying the OrderProcessing Service

Hosting the ShipOrder Workflow Service

Configuring the ServiceHost Application

Testing the Revised OrderProcessing Workflow

Using Content-Based Correlation

Guidelines for Content-Based Correlation

Modifying the ShipOrder Workflow Service

Configuring the ServiceHost Application

Testing the Revised Workflow Service

Implementing a Duplex Message Exchange Pattern

Guidelines for the Duplex Message Exchange Pattern

Declaring the CreditApproval Workflow Service

Modifying the OrderProcessing Service

Hosting the CreditApproval Workflow Service

Configuring the ServiceHost Application

Testing the Revised Workflow Service

Using a Custom Workflow Extension

Implementing the OrderUtilityExtension

Implementing the GetOrderId Activity

Modifying the OrderProcessing Workflow Service

Adding the Extension

Testing the Revised Workflow Service

Understanding Exceptions and Faults

Flowing Transactions into a Workflow Service

Using Standard Behaviors

Summary

imagesChapter 11: Workflow Persistence

The Need for Workflow Persistence

Understanding Workflow Persistence

Instance Stores

Actions that Trigger Persistence

Understanding Durable Delay

Preventing Persistence

Persisted Data and Extension Mechanisms

Understanding WorkflowApplication Persistence

Understanding the SqlWorkflowInstanceStore

Using the SqlWorkflowInstanceStore with WorkflowApplication

Creating the ActivityLibrary Project

Implementing the Item-Related Classes

Implementing the Custom Extension

Implementing Activities that use the Extension

Implementing Bookmark-Related Activities

Declaring the OrderEntry Workflow

Hosting and Persisting the Workflow

Configuring the Application

Testing the Application

Understanding WorkflowServiceHost Persistence

Using the SqlWorkflowInstanceStore with WorkflowServiceHost

Declaring the OrderEntryService Workflow

Hosting the Workflow Service

Testing the ServiceHost Project

Implementing a Client Project

Configuring the Client Project

Testing the Client Project

Summary

imagesChapter 12: Customizing Workflow Persistence

Understanding the PersistenceParticipant Classes

The PersistenceParticipant Class

The PersistenceIOParticipant Class

Which Class to Use?

Using the PersistenceParticipant Class

Modifying the ItemSupportExtension Class

Testing the Revised Extension

Promoting Properties

Using Property Promotion

Modifying the ServiceHost

Modifying the Client Application

Configuring the Client Application

Testing the Revised Example

Understanding the Management Endpoint

Using the Management Endpoint

Modifying the ServiceHost Configuration

Modifying the Client Application

Configuring the Client Application

Testing the Revised Example

Implementing a Custom Instance Store

Understanding the InstanceStore Class

Understanding the Instance Persistence Commands

Understanding the InstancePersistenceContext Class

Implementing a File System–Based Instance Store

Implementing the FileSystemInstanceStoreIO Class

Modifying the ServiceHost Project

Testing the Custom Instance Store

Summary

imagesChapter 13: Transactions, Compensation, and Exception Handling

Understanding Default Exception Handling

Implementing the Example Workflow

Enabling LINQ Access to the AventureWorks Database

Implementing the GetOrderDetail Activity

Implementing the UpdateProductInventory Activity

Implementing the InsertTranHistory Activity

Implementing the ExternalUpdate Activity

Implementing the DisplayProductInventory Activity

Declaring the UpdateInventory Workflow

Declaring the DisplayInventory Workflow

Hosting the Workflow

Testing the Workflow

Understanding the TryCatch Activity

Using the TryCatch Activity

Declaring the UpdateInventoryTryCatch Workflow

Hosting the Workflow

Testing the Workflow

Catching Multiple Exceptions

Testing the Revised Workflow

Understanding the TransactionScope Activity

Using the TransactionScope Activity

Declaring the UpdateInventoryTran Workflow

Hosting the Workflow

Testing the Workflow

Using a Host Transaction

Hosting the Workflow

Testing the Workflow

Understanding Compensation

Using the CompensableActivity

Implementing the ExternalVoid Activity

Declaring the UpdateInventoryComp Workflow

Hosting the Workflow

Testing the Workflow

Manually Triggering Compensation

Declaring the UpdateInventoryManualComp Workflow

Hosting the Workflow

Testing the Workflow

Understanding the CancellationScope Activity

Summary

imagesChapter 14: Workflow Tracking

Understanding Workflow Tracking

Uses of Workflow Tracking

Workflow Tracking Architecture

Tracking Records

Tracking Profiles

Tracking Participants

Using ETW Workflow Tracking

Providing AdventureWorks Access

Copying the Custom Activities

Declaring the Workflow

Hosting the Workflow

Enabling ETW Workflow Tracking

Testing the Workflow

Viewing the Tracking Data

Using Tracking Profiles

Including Selected Workflow Instance States

Including All Workflow Instance States

Adding Selected Activity States

Targeting Selected Activities

Adding Selected Scheduled Records

Including Custom Tracking Records

Developing a Custom Tracking Participant

Implementing the Tracking Record Serializer

Implementing the Custom Tracking Participant

Testing the Tracking Participant

Developing a Nonpersisting Tracking Participant

Implementing the Tracking Participant

Testing the Tracking Participant

Using Workflow Tracking with a Declarative Service Application

Declaring the InventoryService Workflow

Configuring Tracking in the Web.config

Testing the Workflow Service

Loading Tracking Profiles from App.config

Implementing a Tracking Profile Loader

Defining the Tracking Profile in the App.config file

Testing the Tracking Profile Loader

Summary

imagesChapter 15: Enhancing the Design Experience

Understanding Activity Designers

ActivityDesigner

ModelItem

ExpressionTextBox

ArgumentToExpressionConverter

Understanding Expression Types

WorkflowItemPresenter and WorkflowItemsPresenter

Metadata Store and Designer Assignment

The Custom Designer Workflow

Supporting Activity Properties

Creating the Projects

Implementing the CalcShipping Activity

Viewing the Default Design Experience

Declaring a Custom Designer

Associating the Activity with the Designer

Using the MetadataStore to Associate a Designer

Adding an Icon

Supporting Expanded and Collapsed Modes

Declaring the Collapsible Designer

Changing the Designer Attribute

Testing the Collapsible Designer

Supporting a Single Child Activity

Implementing the MyWhile Activity

Declaring a Custom Designer

Testing the Designer

Supporting Multiple Child Activities

Implementing the MySequence Activity

Declaring a Custom Designer

Testing the Designer

Supporting the ActivityAction Activity

Implementing the MyActivityWithAction Activity

Declaring a Custom Designer

Testing the Designer

Understanding Validation

Validation Attributes

Validation Code

Constraints

Using Validation Attributes

Using the RequiredArgument Attribute

Using the OverloadGroup Attribute

Adding Validation in Code

Adding an Error

Adding a Warning

Using Constraints for Validation

Implementing a Simple Constraint

Validating Against Other Activities

Manually Executing Validation

Implementing the Validation Tests

Executing the Validation Tests

Implementing Activity Templates

Implementing the Template

Testing the Template

Summary

imagesChapter 16: Advanced Custom Activities

Understanding Your Parental Responsibilities

Configuring Activity Metadata

Scheduling Child Execution

Handling Child Completion

Handling Bookmarks

Handling a Cancellation Request

Reacting to Abort and Terminate

Scheduling a Single Child

Implementing the Custom Activity

Implementing the Activity Designer

Declaring a Test Workflow

Implementing a Test Application

Testing the Activity

Repeating Execution of a Single Child

Implementing the Custom Activity

Implementing the Activity Designer

Declaring a Test Workflow

Testing the Activity

Handling Exceptions

Throwing an Exception

Handling the Exception

Scheduling Multiple Children

Implementing the Custom Activity

Implementing the Activity Designer

Declaring a Test Workflow

Testing the Activity

Testing the Condition Logic

Scheduling Parallel Execution

Implementing the Custom Activity

Declaring a Test Workflow

Testing the Activity

Scheduling an ActivityAction

Implementing the Custom Activity

Implementing the Activity Designer

Declaring a Test Workflow

Testing the Activity

Using the DynamicActivity Class

The Example Scenario

Constructing a DynamicActivity

Testing the Activity

Using Execution Properties

Implementing the OrderScope Activity

Implementing the OrderAddItems Activity

Declaring a Test Workflow

Testing the Activities

Summary

imagesChapter 17: Hosting the Workflow Designer

Understanding the Workflow Designer Components

Understanding the WorkflowDesigner Class

Understanding the ToolboxControl

Defining New Activities

Understanding the EditingContext

Providing Designer Metadata

The Self-hosting Designer Workflow

Implementing a Simple Workflow Designer

Creating the Application

Declaring the Window Layout

Implementing the Application

Testing the Application

Executing the Workflow

Modifying the Application

Testing the Application

Loading and Saving the Definition

Modifying the Application

Testing the Application

Displaying Validation Errors

Implementing the ValidationErrorService

Modifying the Application

Testing the Application

Adding Activities to the Toolbox

Modifying the Application

Testing the Application

Providing Designer Metadata

Referencing the Custom Designer

Modifying the Application

Testing the Application

Tracking the Selected Activity

Modifying the Application

Testing the Application

Modifying the Context Menu

Modifying the Application

Testing the Application

Locating the Arguments

Modifying the Application

Testing the Application

Summary

imagesChapter 18: WF 3.x Interop and Migration

Reviewing Migration Strategies

Continuing with WF 3.x

Migrating to WF 4

Preparing for Migration

Understanding the Interop Activity

Limitations of the Interop Activity

Invoking a WF 3.x Activity

Implementing a WF 3.5 Activity

Declaring a Test Workflow

Testing the Workflow

Invoking a WF 3.x Workflow

Implementing a WF 3.5 Custom Activity

Implementing the WF 3.5 Workflow

Declaring a Test Workflow

Testing the Workflow

Using the ExternalDataExchangeService

Implementing the Event Arguments

Implementing the Data Exchange Service

Generating the Communication Activities

Declaring the WF 3.5 Workflow

Declaring a Test Workflow

Testing the Workflow

Executing Rules Using the Interop Activity

Implementing the SalesItem Class

Declaring the WF 3.5 Workflow and Rules

Declaring a Test Workflow

Testing the Workflow

Executing Rules Using a Custom Activity

Implementing a SalesItemWrapper

Implementing the ApplyRules Activity

Declaring a Test Workflow

Testing the Workflow

Summary

imagesAppendix A: Glossary

imagesAppendix B: Comparing WF 3.x to WF 4

WF 3.x to WF 4 Architectural Differences

WF 3.x to WF 4 Activities

imagesIndex

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.17.18