E-Book, Englisch, 500 Seiten
Collins Beginning WF
1. ed
ISBN: 978-1-4302-2486-0
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Windows Workflow in .NET 4.0
E-Book, Englisch, 500 Seiten
ISBN: 978-1-4302-2486-0
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Windows Workflow Foundation is a ground-breaking addition to the core of the .NET 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 a workflow-based solution 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. Beginning WF demonstrates, in an eminently readable and accessible style, how Microsoft's Workflow Foundation (WF) technology can be used in a wide variety of applications. Loaded with lots of simple yet demonstrative sample projects Very hands-on with practical 'how-to' information Indexed by feature so specific questions are easily answered
Mark Collins has developed software for more than 25 years, mostly using the Microsoft stack. He has served many roles including development manager, architect, team lead, database administrator, and project manager. He has extensive experience in retail (point-of-sale and inventory) and customer relationship management (CRM) solutions. Mark currently serves as a senior software engineer for a non-profit organization, providing a custom CRM, mail processing, and fulfillment system.
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;5
2;Table of Contents ;7
3;About the Author;19
4;About the Technical Reviewer;20
5;Acknowledgments;21
6;Introduction;22
6.1;How to Use This Book;22
6.2;Chapter Outline;23
6.2.1;Section 1: Basic Concepts;23
6.2.2;Section 2: Designing Workflows;23
6.2.3;Section 3: Communication;23
6.2.4;Section 4: Workflow Extensions;23
6.2.5;Section 5: Advanced Topics;24
6.2.6;Appendix;24
7;PART 1 Introduction;25
7.1;CHAPTER 1 Building a Simple Workflow;26
7.1.1;A Simple Workflow;27
7.1.1.1;Exploring the IDE;27
7.1.1.2;Designing the Workflow;28
7.1.1.3;Reviewing Program.cs;29
7.1.1.4;Running the Application;30
7.1.2;Adding Procedural Elements;30
7.1.2.1;Using Variables;31
7.1.2.2;Assign;34
7.1.2.3;While;35
7.1.2.4;Sequence;36
7.1.2.5;Delay;36
7.1.2.6;More Embellishments;37
7.1.2.7;Running the Application;38
7.1.3;Navigating the Designer;38
7.1.4;Looking a Bit Deeper;40
7.1.5;Differences from Previous Versions;44
7.2;CHAPTER 2 Coded Workflows ;46
7.2.1;Creating a Console Application;46
7.2.2;Defining the Workflow;47
7.2.2.1;Implementing Level 1;48
7.2.2.2;Implementing Level 2;49
7.2.2.2.1;Expressions;50
7.2.2.3;Implementing Level 3;51
7.2.2.3.1;Assign Activity;51
7.2.2.3.2;Sequence;51
7.2.3;Running the Application;52
7.2.4;Review;55
7.3;CHAPTER 3 Flowchart Workflow;56
7.3.1;Creating a Flowchart Workflow;56
7.3.1.1;Designing the Flowchart;57
7.3.1.2;Defining Connections;57
7.3.1.3;FlowDecision;58
7.3.1.4;Running the Application;60
7.3.2;Flow Switch;61
7.3.2.1;Adding a FlowSwitch Activity;61
7.3.2.2;Adding the FlowStep Activities;62
7.3.2.3;Running the Application;63
7.3.3;Parallel;63
7.3.3.1;Adding a Parallel Activity;63
7.3.3.2;Adding the Branches;64
7.3.3.3;Running the Application;65
8;PART 2 Designing Workflows;66
8.1;CHAPTER 4 Passing Arguments;67
8.1.1;Creating a New Solution;67
8.1.1.1;Defining the Order Class;68
8.1.2;Implementing the Workflow;70
8.1.2.1;Defining the Arguments;71
8.1.2.2;Designing the Workflow;73
8.1.2.3;Switch Activity;73
8.1.2.4;Expression Activities;75
8.1.3;Invoking the Workflow;78
8.1.4;Running the Application;80
8.2;CHAPTER 5 Replicated Activities;81
8.2.1;Reusing the Chapter 4 Project;81
8.2.2;Adding OrderItem Processing;83
8.2.2.1;ForEach Activity;83
8.2.2.2;Adding Order Items;87
8.2.2.3;Running the Application;88
8.2.2.4;ParallelForEach Activity;90
8.3;CHAPTER 6 Exception Handling;91
8.3.1;Reusing the Chapter 5 Project;91
8.3.2;Adding the Check Stock Activity;92
8.3.2.1;TryCatch Activity;92
8.3.2.2;Defining an Exception;92
8.3.2.3;ForEach Activity;94
8.3.2.4;If Activity;94
8.3.2.5;Throw Activity;95
8.3.2.6;Catch Activity;96
8.3.2.7;Running the Application;98
8.3.3;Exceptions;99
8.4;CHAPTER 7 Extending the Built-In Activities;101
8.4.1;Reusing the Chapter 6 Project;101
8.4.2;Using Custom Activities;102
8.4.2.1;Implementing a Custom Activity;102
8.4.2.2;Using the LookupItem Activity;104
8.4.2.3;Running the Application;107
8.4.3;InvokeMethod Activity;108
8.4.3.1;Creating a Discount Class;108
8.4.3.2;Using the InvokeMethod Activity;109
8.4.3.2.1;Specifying the Target Object;109
8.4.3.2.2;Specifying the Parameters;110
8.4.3.2.3;Specifying the Result;111
8.4.3.3;Adding the Discount;113
8.4.3.4;Running the Application;113
8.4.4;Summary;114
9;PART 3 Communication;115
9.1;CHAPTER 8 Send and Receive;116
9.1.1;Creating the Project;116
9.1.1.1;Define the Messages;117
9.1.1.1.1;MessageContract;120
9.1.1.1.2;ServiceContract;121
9.1.1.2;Application Configuration;122
9.1.2;Defining the Workflows;123
9.1.2.1;Client–SendRequest;123
9.1.2.1.1;Send Activity;125
9.1.2.1.2;Custom Activity—CreateRequest;125
9.1.2.1.3;ReceiveReply Activity;128
9.1.2.2;Server–ProcessRequest;128
9.1.2.2.1;Receive Activity;129
9.1.2.2.2;Custom Activity—CreateResponse;129
9.1.2.2.3;SendReply Activity;131
9.1.3;Implementing the Application;135
9.1.3.1;WorkflowServiceHost;135
9.1.3.1.1;Service;136
9.1.3.1.2;Endpoint;136
9.1.3.2;WorkflowInvoker;137
9.1.4;Running the Application;139
9.1.4.1;Configuring a Library Branch;139
9.1.4.2;Expected Results;141
9.2;CHAPTER 9 Communicating withthe Host Application;144
9.2.1;Creating a WPF Project;144
9.2.1.1;Reusing the Classes from Chapter 8;145
9.2.1.2;Defining the Window Form;146
9.2.2;Implementing a TextWriter;148
9.2.2.1;Providing a Static Application Reference;149
9.2.2.2;Implementing ListBoxTextWriter;150
9.2.3;Implementing the Workflows;152
9.2.3.1;Listening for Messages;153
9.2.3.1.1;Implementing the Service Contract;154
9.2.3.1.2;Implementing a ServiceHost;155
9.2.3.2;Bookmarks;156
9.2.3.3;Implementing the SendRequest Workflow;158
9.2.3.4;Implementing the ProcessRequest Workflow;160
9.2.4;Implementing the Application;162
9.2.4.1;Maintaining Workflow Instances;162
9.2.4.2;Event Handlers;163
9.2.4.3;ApplicationInterface Methods;165
9.2.5;Running the Application;169
9.3;CHAPTER 10 Web Services;172
9.3.1;Creating a Workflow Service;172
9.3.1.1;Defining the Service Contract;173
9.3.1.2;Configuring Receive and SendReply;176
9.3.1.3;Creating the PerformLookup Activity;179
9.3.1.4;Testing the Service;182
9.3.2;Using Parameters;183
9.3.2.1;Creating a Second Service;184
9.3.2.2;Creating a Modified PerformLookup Activity;187
9.3.2.3;Testing the Service;188
9.3.3;Creating a Client Workflow;189
9.3.3.1;Defining the Workflow;191
9.3.3.2;Implementing the Host Application;192
9.3.3.3;Running the Application;193
9.3.4;Using Pick;194
9.3.5;Review;195
10;PART 4 Workflow Extensions;196
10.1;CHAPTER 11 SQL Persistence ;197
10.1.1;Creating the Application;197
10.1.1.1;Renaming the Window;198
10.1.1.2;Defining the Window Form;198
10.1.1.3;Implementing a TextWriter;201
10.1.2;Setting Up the Database;205
10.1.2.1;Creating a Database;205
10.1.2.2;Installing the Schema;205
10.1.2.3;Creating the LINQ to SQL Classes;208
10.1.3;Designing the Workflow;211
10.1.3.1;Custom CreateLead Activity;211
10.1.3.2;Custom WaitForInput Activity;213
10.1.3.3;Defining the Workflow Activities;213
10.1.4;Implementing the Application;215
10.1.4.1;Application Configuration File;216
10.1.4.2;Configuring the Persistence Provider Factory;216
10.1.4.3;Creating Leads;217
10.1.4.4;Assigning Leads;218
10.1.4.5;Loading Existing Leads;220
10.1.5;Running the Application;224
10.1.6;Digging a Bit Deeper;226
10.1.6.1;Persisting Arguments and Variables;227
10.2;CHAPTER 12 Extensions;228
10.2.1;Setting Up the Solution;228
10.2.1.1;Copy Solution from Chapter 11;229
10.2.1.2;Setting Up the Database;229
10.2.1.3;Implementing SetupInstance;229
10.2.1.4;Running the Application;230
10.2.2;Extensions;230
10.2.2.1;Implementing a Simple Extension;230
10.2.2.2;Configuring the Extension;231
10.2.2.3;Using the Extension in an Activity;232
10.2.2.4;Updating the Application;233
10.2.3;Participating in Persistence;234
10.2.3.1;Creating the Extension;234
10.2.3.2;PersistenceParticipant;235
10.2.3.3;AddComment Activity;235
10.2.3.3.1;GetComments Activity;237
10.2.3.4;Modifying the Workflow;237
10.2.3.5;Accessing the Extension from the Application;237
10.2.3.6;Event Handler Syntax;238
10.2.4;Running the Application;239
10.3;CHAPTER 13 Tracking;247
10.3.1;Setting Up the Solution;247
10.3.1.1;Copy Solution from Chapter 12;248
10.3.1.2;Setting Up the Database;248
10.3.1.3;Tracking Participants;248
10.3.2;ListBoxTrackingParticipant;248
10.3.2.1;Overriding the Track() Method;250
10.3.2.2;Configuring a Tracking Participant;251
10.3.2.3;Configuring a Tracking Profile;252
10.3.2.3.1;WorkflowInstanceQuery;253
10.3.2.3.2;BookmarkResumptionQuery;253
10.3.2.3.3;ActivityStateQuery;253
10.3.2.3.4;CustomTrackingQuery;254
10.3.2.4;CustomTrackingRecord;254
10.3.2.5;Running the Application;256
10.3.3;Event Tracing for Windows (ETW);256
10.3.3.1;Setting Up the Extension;256
10.3.3.2;Configuring the TrackingProfile;257
10.3.3.3;Running the Application;257
10.3.4;SqlTrackingParticipant;259
10.3.4.1;Setting up the Database;259
10.3.4.2;Implementing the SqlTrackingParticipant;261
10.3.4.3;Configuring the Tracking Participant;263
10.3.4.4;Running the Application;265
10.4;CHAPTER 14 Transactions;273
10.4.1;Setting Up the Solution;273
10.4.2;Assignments;274
10.4.2.1;Adding the LINQ to SQL Class;274
10.4.2.2;AssignLead Activity;276
10.4.2.2.1;RuntimeTransactionHandle;278
10.4.2.3;CreateAssignment Activity;278
10.4.3;Application Changes;280
10.4.3.1;Updating the List of Leads;280
10.4.3.2;Removing Database Updates;281
10.4.3.3;Adding Workflow Event Handlers;282
10.4.4;Workflow Changes;290
10.4.4.1;TransactionScope;291
10.4.4.2;InvokeMethod;291
10.4.5;Running the Application;294
10.5;CHAPTER 15 Transactions with Persistence;295
10.5.1;Setting Up the Solution;295
10.5.2;PersistenceParticipant;296
10.5.3;PersistLead Extension;296
10.5.3.1;Connecting to the Database;299
10.5.3.2;Performing the Updates;299
10.5.4;Using the PersistLead Extension;299
10.5.4.1;Modifying the CreateLead Activity;300
10.5.4.2;Modifying the AssignLead Activity;301
10.5.5;PersistAssignment Extension;302
10.5.6;Using the PersistAssignment Extension;304
10.5.7;Application Changes;305
10.5.8;Running the Application;305
10.6;CHAPTER 1 6 WorkflowServiceHost;306
10.6.1;Setting Up the Solution;306
10.6.2;Adding LeadResponse;307
10.6.2.1;Renaming the Window;308
10.6.2.2;Defining the Window Form;308
10.6.2.3;Copying Classes from LeadGenerator;311
10.6.2.4;Implementing the Application;311
10.6.3;WorkflowService;317
10.6.3.1;Behaviors;318
10.6.3.2;DBExtensionBehavior;318
10.6.3.3;PersistAssignmentBehavior;320
10.6.4;Defining the Workflows;321
10.6.4.1;CompleteAssignment;321
10.6.4.2;EnterLead Workflow Modifications;322
10.6.4.3;WorkAssignment Workflow;325
10.6.4.4;Persist;328
10.6.5;Final Application Changes;328
10.6.5.1;ApplicationInterface;328
10.6.5.2;Adding the app.config File;329
10.6.5.3;LINQ Conflict;330
10.6.6;Running the Applications;331
10.6.7;Review;333
11;PART 5 Advanced Topics;334
11.1;CHAPTER 17 Compensation, Confirmation, and Cancellation;335
11.1.1;Designing the Workflow;336
11.1.1.1;Modifying the Application;336
11.1.1.2;Configuring a TryCatch Activity;338
11.1.1.3;Using a Parallel Activity;339
11.1.1.4;CompensableActivity;340
11.1.1.5;Designing the Wedding Activity;341
11.1.1.6;Designing the Reception Activity;343
11.1.1.6.1;Designing Confirmation Activities;344
11.1.1.7;Designing the Invitations Activity;344
11.1.1.7.1;Designing the Confirmation Activities;345
11.1.1.8;Running the Application;346
11.1.2;Cancellation Handlers;347
11.1.2.1;More on the Parallel Activity;347
11.1.3;Designing Compensation Handlers;348
11.1.3.1;Designing the Wedding Compensation;348
11.1.3.2;Designing the Reception Compensation;349
11.1.3.3;Running the Application;350
11.1.4;Customizing Compensation and Confirmation;353
11.1.4.1;Adding the Token Variables;353
11.1.4.2;Setting the Result Property;355
11.1.4.3;Custom Confirmation;355
11.1.4.4;Custom Compensation;357
11.1.4.5;Rethrow Activity;358
11.2;CHAPTER 18 Collections;361
11.2.1;Creating a Collection;361
11.2.1.1;Defining the Shopping List;362
11.2.1.2;Initial Workflow;362
11.2.1.3;AddToCollection Activity;364
11.2.1.4;Invoking a Workflow;364
11.2.1.5;Running the Application;365
11.2.2;Printing and Sorting;365
11.2.2.1;Printing the Collection;365
11.2.2.2;Sorting the Collection;367
11.2.3;Searching the Collection;369
11.2.3.1;Overriding the Equals() Method;369
11.2.3.2;ExistsInCollection Activity;370
11.2.3.3;RemoveFromCollection Activity;371
11.2.4;ClearCollection Activity;371
11.3;CHAPTER 19 Interoperability with Workflow 3.5;377
11.3.1;Creating a 4.0 Workflow;377
11.3.1.1;Creating a 3.5 Workflow;378
11.3.1.2;Interop Activity;382
11.3.1.3;Running the Application;383
11.3.2;Executing a Custom 3.5 Activity;383
11.3.2.1;Creating a Custom Activity;384
11.3.2.2;Throwing an Exception;386
11.3.2.3;Invoking the Custom Activity;387
11.3.2.4;Running the Application;390
11.4;CHAPTER 20 Policy;391
11.4.1;Creating a Custom Activity;391
11.4.1.1;Defining the Data Structures;392
11.4.1.2;PolicyActivity;395
11.4.1.3;Adding Dependency Properties;396
11.4.1.4;Creating a Rule Set;399
11.4.1.5;Defining the Rules;400
11.4.1.6;Understanding Rule Sets;403
11.4.1.6.1;Rules;403
11.4.1.6.2;Chaining;404
11.4.1.6.3;Halt and Update;405
11.4.1.6.4;Rules File;405
11.4.1.7;Determining the Priority;406
11.4.1.8;Entering the Priority Rules;407
11.4.2;Creating a Workflow Application;408
11.4.2.1;Creating a Custom Activity;409
11.4.2.2;Incrementing the Activity Counters;412
11.4.2.3;Creating the Main Workflow;416
11.4.2.4;Configuring the Arguments;416
11.4.2.5;Implementing the Console Application;418
11.4.2.6;Running the Application;419
11.4.3;Review;419
12;APPENDIX Sample Workflow Project;421
12.1;Project Overview;421
12.1.1;Configuring the Database;421
12.1.2;Running the Application;422
12.1.2.1;Logging In;423
12.1.2.2;Submitting a Request;424
12.1.2.3;Processing Requests;425
12.1.2.4;Tracking the Workflow;429
12.2;Generic Queue Logic;429
12.2.1;Database Design;430
12.2.2;Activities;431
12.2.3;CompleteInstance;431
12.2.4;QCPolicy;432
12.2.5;Tracking;434
12.3;Service Layer;436
12.3.1;Service Contract;436
12.3.2;Database Design;438
12.3.3;Activities;439
12.3.4;Workflow Design;440
12.3.4.1;SubmitRequest;441
12.3.4.2;Processing a Request;443
12.3.5;Correlation;444
12.3.6;Using WorkflowServiceHost;446
12.3.6.1;Writing Extensions;447
12.3.6.2;Configuring Extensions;450
12.3.6.3;Configuring Persistence;450
12.3.6.4;Configuring Tracking;451
12.4;Summary;453
13;Index;454




