You are previewing Pro WF: Windows Workflow in .NET 4.
O'Reilly logo
Pro WF: Windows Workflow in .NET 4

Book Description

Windows Workflow Foundation (WF) is a revolutionary part of the .NET 4 Framework that allows you to orchestrate human and system interactions as a series of workflows that can be easily mapped, analyzed, adjusted, and implemented. As business problems become more complex, the need for workflow-based solutions has never been more evident. WF provides a simple and consistent way to model and implement complex problems. As a developer, you focus on developing the business logic for individual workflow tasks. The runtime handles the execution of those tasks after they have been composed into a workflow.

Pro WF: Windows Workflow in .NET 4 provides you with the skills you need to incorporate WF in your applications, using a lively tutorial style with each example illustrated in C#. This book gets you up to speed with WF 4 quickly and comprehensively. Learn about WF 4's new designer, it's updated programming paradigm, and the completely new set of activities that can enable and extend your workflows. This book also includes detailed coverage of how to customize your workflows and access them in a variety of ways and situations so you can maximize the advantages of this technology.

What you'll learn

  • WF 4 basics

  • New activities and changes to existing activities in WF 4

  • Customizing your workflows

  • Accessing your workflows in a variety of ways in a variety of situations

  • Using WF with Web Services and ASP.NET

  • Integrating WCF and WF

  • Who this book is for

    This book is for intermediate to advanced .NET developers who need to learn how to use the latest version of Windows Workflow Foundation (WF 4). This book is not a primer on .NET or the C# language. To get the most out of the examples presented in this book, it is necessary to have a good working knowledge of .NET 2.0 or higher. All of the examples are presented in C#.

    Table of Contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. CHAPTER 1: A Quick Tour of Windows Workflow Foundation
      1. Why Workflow?
      2. Your Development Environment
      3. The Workflow Workflow
      4. Hello Workflow
      5. Passing Parameters
      6. Making Decisions
      7. Unit Testing
      8. Summary
    10. CHAPTER 2: Foundation Overview
      1. WF Features and Capabilities
      2. Assemblies and Namespaces
      3. Activity Life Cycle
      4. Expressions
      5. Missing 4 Features
      6. Summary
    11. CHAPTER 3: Activities
      1. Understanding Activities
      2. An Example Activity
      3. Implementing an Activity in Code
      4. Declaring an Activity with Xaml
      5. Declaring an Activity with Code
      6. Implementing an Asynchronous Activity
      7. Using Activities
      8. Standard Activities Summary
      9. Standard Activities
      10. Summary
    12. CHAPTER 4: Workflow Hosting
      1. Understanding the WorkflowInvoker Class
      2. Using the WorkflowInvoker Static Methods
      3. Using the WorkflowInvoker Instance Methods
      4. Understand the WorkflowApplication Class
      5. Using the WorkflowApplication Class
      6. Understanding the ActivityXamlServices Class
      7. Using the ActivityXamlServices Class
      8. Invoke Workflows from ASP.NET
      9. Managing Multiple Workflow Instances
      10. Summary
    13. CHAPTER 5: Procedural Flow Control
      1. Understanding the Procedural Modeling Style
      2. Making Decisions
      3. Understanding the While and DoWhile Activities
      4. Using the While and DoWhile Activities
      5. Understanding the Parallel Activity
      6. Using the Parallel Activity
      7. Obtaining Asynchronous Execution with the Parallel Activity
      8. Summary
    14. CHAPTER 6: Collection-Related Activities
      1. Understanding the ForEach<T> Activity
      2. Understanding the Collection Activities
      3. Using the ForEach<T> and Collection Activities
      4. Using the ParallelForEach<T> Activity
      5. Working with Dictionaries
      6. Understanding the InvokeMethod Activity
      7. Using the InvokeMethod Activity
      8. Summary
    15. CHAPTER 7: Flowchart Modeling Style
      1. Understanding the Flowchart Modeling Style
      2. Using the Flowchart Modeling Style
      3. Making Simple Decisions
      4. Declaring Looping Behavior
      5. Declaring Custom Activities
      6. Mixing the Two Styles
      7. Summary
    16. CHAPTER 8: Host Communication
      1. The Need for Long-Running Workflows
      2. Understanding Bookmarks
      3. Using Bookmarks
      4. Understanding Workflow Extensions
      5. Using Workflow Extensions
      6. Using an Alternate Extension
      7. Understanding the ActivityAction
      8. Using the ActivityAction
      9. Understanding the Pick Activity
      10. Using the Pick Activity
      11. Summary
    17. CHAPTER 9: Workflow Services
      1. Introducing Workflow Services
      2. Understanding WCF
      3. Understanding Workflow Services
      4. Declaring a Workflow Service
      5. Publishing a Workflow Service to IIS
      6. Implementing a Client Application
      7. Implementing a Workflow Client
      8. Self-hosting the Workflow Service
      9. Summary
    18. CHAPTER 10: Workflow Services Advanced Topics
      1. Using Context-Based Correlation
      2. Using Content-Based Correlation
      3. Implementing a Duplex Message Exchange Pattern
      4. Using a Custom Workflow Extension
      5. Understanding Exceptions and Faults
      6. Flowing Transactions into a Workflow Service
      7. Using Standard Behaviors
      8. Summary
    19. CHAPTER 11: Workflow Persistence
      1. The Need for Workflow Persistence
      2. Understanding Workflow Persistence
      3. Understanding WorkflowApplication Persistence
      4. Understanding the SqlWorkflowInstanceStore
      5. Using the SqlWorkflowInstanceStore with WorkflowApplication
      6. Understanding WorkflowServiceHost Persistence
      7. Using the SqlWorkflowInstanceStore with WorkflowServiceHost
      8. Summary
    20. CHAPTER 12: Customizing Workflow Persistence
      1. Understanding the PersistenceParticipant Classes
      2. Using the PersistenceParticipant Class
      3. Promoting Properties
      4. Using Property Promotion
      5. Understanding the Management Endpoint
      6. Using the Management Endpoint
      7. Implementing a Custom Instance Store
      8. Summary
    21. CHAPTER 13: Transactions, Compensation, and Exception Handling
      1. Understanding Default Exception Handling
      2. Implementing the Example Workflow
      3. Understanding the TryCatch Activity
      4. Using the TryCatch Activity
      5. Understanding the TransactionScope Activity
      6. Using the TransactionScope Activity
      7. Using a Host Transaction
      8. Understanding Compensation
      9. Using the CompensableActivity
      10. Manually Triggering Compensation
      11. Understanding the CancellationScope Activity
      12. Summary
    22. CHAPTER 14: Workflow Tracking
      1. Understanding Workflow Tracking
      2. Using ETW Workflow Tracking
      3. Using Tracking Profiles
      4. Developing a Custom Tracking Participant
      5. Developing a Nonpersisting Tracking Participant
      6. Using Workflow Tracking with a Declarative Service Application
      7. Loading Tracking Profiles from App.config
      8. Summary
    23. CHAPTER 15: Enhancing the Design Experience
      1. Understanding Activity Designers
      2. Supporting Activity Properties
      3. Supporting Expanded and Collapsed Modes
      4. Supporting a Single Child Activity
      5. Supporting Multiple Child Activities
      6. Supporting the ActivityAction Activity
      7. Understanding Validation
      8. Using Validation Attributes
      9. Adding Validation in Code
      10. Using Constraints for Validation
      11. Manually Executing Validation
      12. Implementing Activity Templates
      13. Summary
    24. CHAPTER 16: Advanced Custom Activities
      1. Understanding Your Parental Responsibilities
      2. Scheduling a Single Child
      3. Repeating Execution of a Single Child
      4. Handling Exceptions
      5. Scheduling Multiple Children
      6. Scheduling Parallel Execution
      7. Scheduling an ActivityAction
      8. Using the DynamicActivity Class
      9. Using Execution Properties
      10. Summary
    25. CHAPTER 17: Hosting the Workflow Designer
      1. Understanding the Workflow Designer Components
      2. Implementing a Simple Workflow Designer
      3. Executing the Workflow
      4. Loading and Saving the Definition
      5. Displaying Validation Errors
      6. Adding Activities to the Toolbox
      7. Providing Designer Metadata
      8. Tracking the Selected Activity
      9. Modifying the Context Menu
      10. Locating the Arguments
      11. Summary
    26. CHAPTER 18: WF 3.x Interop and Migration
      1. Reviewing Migration Strategies
      2. Understanding the Interop Activity
      3. Invoking a WF 3.x Activity
      4. Invoking a WF 3.x Workflow
      5. Using the ExternalDataExchangeService
      6. Executing Rules Using the Interop Activity
      7. Executing Rules Using a Custom Activity
      8. Summary
    27. APPENDIX A: Glossary
    28. APPENDIX B: Comparing WF 3.x to WF 4
      1. WF 3.x to WF 4 Architectural Differences
      2. WF 3.x to WF 4 Activities
    29. Index