Have you ever spent hours coding workflow for your applications? If so, the new Microsoft Windows Workflow Foundation (WF) technology will make your life easier. Foundations of WF: An Introduction to Windows Workflow Foundation introduces you to using Visual Studio 2005 and the Windows Workflow Foundation (part of Windows Vista) to create workflow packages. The book begins by giving you an overview of Windows Workflow Foundation. Then it introduces and shows examples of the various types of workflow that can be created.
You’ll discover the power of WF. You’ll learn about all the prebuild activities you can include in your workflow, along with how to create your own activities. WF is fully extensible and allows you an unlimited number of options for your workflow. You’ll also learn how to use workflow activities to retrieve data, and finally, how to tie an ASP.NET application with a workflow built in WF.
This book, unlike most of the Microsoft WF samples, has code in both Visual Basic .NET and C#. All the examples—and there are many—have VB .NET code, and many have the accompanying C# code. This book will allow you to begin creating new workflow applications easily in either VB .NET or C#. Each chapter includes an introduction to one or more activities that make up WF, along with examples of how to use each activity. Many chapters include a final section providing a real world example (a purchase order system). This book will have you using WF to create workflow applications with VB .NET or C# in a short amount of time.
Le informazioni nella sezione "Riassunto" possono far riferimento a edizioni diverse di questo titolo.
Brian Myers is a Microsoft Certified Professional and Microsoft Certified Application Developer for .NET. He is currently a software engineer and database administrator.
Contents
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xi
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
CHAPTER 1 Introduction to Workflow and Windows
Workflow Foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What Is Workflow? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
When to Use Which Workflow Type . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Why Use Workflows? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Introducing Windows Workflow Foundation . . . . . . . . . . . . . . . . . . . . . . . . 3
Architecture of Windows Workflow Foundation . . . . . . . . . . . . . . . . . . . . . . 3
Getting Started with WF and VS2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Out-of-the-Box Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
CHAPTER 2 First Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Workflow and Activities As Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Workflow Code in VB .NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Workflow Code in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
First Workflow in VB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Sequential Workflow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Passing Parameters to VB .NET Workflow . . . . . . . . . . . . . . . . . . . . . 24
State Machine Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
First Workflow in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Code Differences Between VB and C# . . . . . . . . . . . . . . . . . . . . . . . . 31
Passing Parameters to C# Workflow . . . . . . . . . . . . . . . . . . . . . . . . . 33
Real-World Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
CHAPTER 3 Conditional Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
IfElse Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
IfElse Activity Within Sequential Workflow. . . . . . . . . . . . . . . . . . . . . 43
IfElse Activity Within State Machine Workflow . . . . . . . . . . . . . . . . . 49
While Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
While Activity Within Sequential Workflow . . . . . . . . . . . . . . . . . . . . 53
While Activity Within State Machine Workflow . . . . . . . . . . . . . . . . . 54
Conditional Activity Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Conditional Activity Group Within Sequential Workflow . . . . . . . . . . 55
Conditional Activity Group Within State Machine Workflow. . . . . . . 57
Real-World Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 4 Flow Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
State Machine Specific Control Activities . . . . . . . . . . . . . . . . . . . . . . . . . 67
State-Related Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Delay, Suspend, and Terminate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Delay, Suspend, and Terminate in VB . . . . . . . . . . . . . . . . . . . . . . . . 71
Delay, Suspend, and Terminate in C# . . . . . . . . . . . . . . . . . . . . . . . . 79
Sequence and Parallel Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Sequence Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
State Machine Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
EventDriven Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Real-World Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
CHAPTER 5 Rules-Based Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Rules in WF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Rules and the Policy Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Sequential Chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Full Chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Real-World Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
CHAPTER 6 Workflow and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
InvokeWebService Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Workflow As Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
CHAPTER 7 Interacting with Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Workflow Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
CallExternalMethod Activity in VB . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
CallExternalMethod Activity in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Events in VB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Events in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Workflow Fault Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Transaction Scope and Compensate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
CHAPTER 8 Custom Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Basics of a Custom Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Creating a New Activity from the Activity Class . . . . . . . . . . . . . . . . . . . 141
Example in VB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Example in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Real-World Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
CHAPTER 9 Deploying Workflow Applications . . . . . . . . . . . . . . . . . . . . . . . 163
Deployment Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Real-World Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
ClickOnce Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
SQLPersistenceService . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Implementing Persistence in VB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Implementing Persistence in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
CHAPTER 10 Employee Performance Review Application . . . . . . . . . . . . 173
Workflow Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Employee Performance Review Business Process . . . . . . . . . . . . . 173
Translating Model into Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Application Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Create the EPR Database and Tables . . . . . . . . . . . . . . . . . . . . . . . . 178
Create the SQLPersistenceService SQL Server Database . . . . . . . 190
Create a New ASP.NET Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Build All ASP.NET Web Pages That Don’t Interact with the Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Build the Complete Workflow and Test with a Simple Console Application First . . . . . . . . . . . . . . . . . . ...
Le informazioni nella sezione "Su questo libro" possono far riferimento a edizioni diverse di questo titolo.
GRATIS per la spedizione in U.S.A.
Destinazione, tempi e costiDa: Redux Books, Grand Rapids, MI, U.S.A.
Paperback. Condizione: New. New paperback from bookstore stock. An unread copy. May have minor rubbing and scuffing from shelf wear.; 100% Satisfaction Guaranteed! Ships same or next business day! Codice articolo 111710110023
Quantità: 1 disponibili
Da: Books Puddle, New York, NY, U.S.A.
Condizione: New. pp. 260. Codice articolo 26296736
Quantità: 1 disponibili
Da: Majestic Books, Hounslow, Regno Unito
Condizione: New. pp. 260 Illus. Codice articolo 7551231
Quantità: 1 disponibili
Da: Lucky's Textbooks, Dallas, TX, U.S.A.
Condizione: New. Codice articolo ABLIING23Mar2811580082239
Quantità: Più di 20 disponibili
Da: Biblios, Frankfurt am main, HESSE, Germania
Condizione: New. pp. 260. Codice articolo 18296746
Quantità: 1 disponibili
Da: Romtrade Corp., STERLING HEIGHTS, MI, U.S.A.
Condizione: New. This is a Brand-new US Edition. This Item may be shipped from US or any other country as we have multiple locations worldwide. Codice articolo ABNR-124451
Quantità: 1 disponibili
Da: Basi6 International, Irving, TX, U.S.A.
Condizione: Brand New. New. US edition. Expediting shipping for all USA and Europe orders excluding PO Box. Excellent Customer Service. Codice articolo ABEJUNE24-195568
Quantità: 1 disponibili
Da: THE SAINT BOOKSTORE, Southport, Regno Unito
Paperback / softback. Condizione: New. This item is printed on demand. New copy - Usually dispatched within 5-9 working days 524. Codice articolo C9781590597187
Quantità: Più di 20 disponibili
Da: Ria Christie Collections, Uxbridge, Regno Unito
Condizione: New. In. Codice articolo ria9781590597187_new
Quantità: Più di 20 disponibili
Da: Revaluation Books, Exeter, Regno Unito
Paperback. Condizione: Brand New. 240 pages. 10.00x7.25x0.50 inches. In Stock. Codice articolo x-1590597184
Quantità: 2 disponibili