Beginning WF - Mark Collins

Beginning WF (eBook)

Windows Workflow in .NET 4.0

(Autor)

eBook Download: PDF
2010 | 1st ed.
500 Seiten
Apress (Verlag)
978-1-4302-2486-0 (ISBN)
Systemvoraussetzungen
44,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

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.
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 "e;how-to"e; 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.

Contents at a Glance 5
Table of Contents 7
About the Author 19
About the Technical Reviewer 20
Acknowledgments 21
Introduction 22
How to Use This Book 22
Chapter Outline 23
Section 1: Basic Concepts 23
Section 2: Designing Workflows 23
Section 3: Communication 23
Section 4: Workflow Extensions 23
Section 5: Advanced Topics 24
Appendix 24
PART 1 Introduction 25
CHAPTER 1 Building a Simple Workflow 26
A Simple Workflow 27
Exploring the IDE 27
Designing the Workflow 28
Reviewing Program.cs 29
Running the Application 30
Adding Procedural Elements 30
Using Variables 31
Assign 34
While 35
Sequence 36
Delay 36
More Embellishments 37
Running the Application 38
Navigating the Designer 38
Looking a Bit Deeper 40
Differences from Previous Versions 44
CHAPTER 2 Coded Workflows 46
Creating a Console Application 46
Defining the Workflow 47
Implementing Level 1 48
Implementing Level 2 49
Expressions 50
Implementing Level 3 51
Assign Activity 51
Sequence 51
Running the Application 52
Review 55
CHAPTER 3 Flowchart Workflow 56
Creating a Flowchart Workflow 56
Designing the Flowchart 57
Defining Connections 57
FlowDecision 58
Running the Application 60
Flow Switch 61
Adding a FlowSwitch Activity 61
Adding the FlowStep Activities 62
Running the Application 63
Parallel 63
Adding a Parallel Activity 63
Adding the Branches 64
Running the Application 65
PART 2 Designing Workflows 66
CHAPTER 4 Passing Arguments 67
Creating a New Solution 67
Defining the Order Class 68
Implementing the Workflow 70
Defining the Arguments 71
Designing the Workflow 73
Switch Activity 73
Expression Activities 75
Invoking the Workflow 78
Running the Application 80
CHAPTER 5 Replicated Activities 81
Reusing the Chapter 4 Project 81
Adding OrderItem Processing 83
ForEach Activity 83
Adding Order Items 87
Running the Application 88
ParallelForEach Activity 90
CHAPTER 6 Exception Handling 91
Reusing the Chapter 5 Project 91
Adding the Check Stock Activity 92
TryCatch Activity 92
Defining an Exception 92
ForEach Activity 94
If Activity 94
Throw Activity 95
Catch Activity 96
Running the Application 98
Exceptions 99
CHAPTER 7 Extending the Built-In Activities 101
Reusing the Chapter 6 Project 101
Using Custom Activities 102
Implementing a Custom Activity 102
Using the LookupItem Activity 104
Running the Application 107
InvokeMethod Activity 108
Creating a Discount Class 108
Using the InvokeMethod Activity 109
Specifying the Target Object 109
Specifying the Parameters 110
Specifying the Result 111
Adding the Discount 113
Running the Application 113
Summary 114
PART 3 Communication 115
CHAPTER 8 Send and Receive 116
Creating the Project 116
Define the Messages 117
MessageContract 120
ServiceContract 121
Application Configuration 122
Defining the Workflows 123
Client–SendRequest 123
Send Activity 125
Custom Activity—CreateRequest 125
ReceiveReply Activity 128
Server–ProcessRequest 128
Receive Activity 129
Custom Activity—CreateResponse 129
SendReply Activity 131
Implementing the Application 135
WorkflowServiceHost 135
Service 136
Endpoint 136
WorkflowInvoker 137
Running the Application 139
Configuring a Library Branch 139
Expected Results 141
CHAPTER 9 Communicating withthe Host Application 144
Creating a WPF Project 144
Reusing the Classes from Chapter 8 145
Defining the Window Form 146
Implementing a TextWriter 148
Providing a Static Application Reference 149
Implementing ListBoxTextWriter 150
Implementing the Workflows 152
Listening for Messages 153
Implementing the Service Contract 154
Implementing a ServiceHost 155
Bookmarks 156
Implementing the SendRequest Workflow 158
Implementing the ProcessRequest Workflow 160
Implementing the Application 162
Maintaining Workflow Instances 162
Event Handlers 163
ApplicationInterface Methods 165
Running the Application 169
CHAPTER 10 Web Services 172
Creating a Workflow Service 172
Defining the Service Contract 173
Configuring Receive and SendReply 176
Creating the PerformLookup Activity 179
Testing the Service 182
Using Parameters 183
Creating a Second Service 184
Creating a Modified PerformLookup Activity 187
Testing the Service 188
Creating a Client Workflow 189
Defining the Workflow 191
Implementing the Host Application 192
Running the Application 193
Using Pick 194
Review 195
PART 4 Workflow Extensions 196
CHAPTER 11 SQL Persistence 197
Creating the Application 197
Renaming the Window 198
Defining the Window Form 198
Implementing a TextWriter 201
Setting Up the Database 205
Creating a Database 205
Installing the Schema 205
Creating the LINQ to SQL Classes 208
Designing the Workflow 211
Custom CreateLead Activity 211
Custom WaitForInput Activity 213
Defining the Workflow Activities 213
Implementing the Application 215
Application Configuration File 216
Configuring the Persistence Provider Factory 216
Creating Leads 217
Assigning Leads 218
Loading Existing Leads 220
Running the Application 224
Digging a Bit Deeper 226
Persisting Arguments and Variables 227
CHAPTER 12 Extensions 228
Setting Up the Solution 228
Copy Solution from Chapter 11 229
Setting Up the Database 229
Implementing SetupInstance 229
Running the Application 230
Extensions 230
Implementing a Simple Extension 230
Configuring the Extension 231
Using the Extension in an Activity 232
Updating the Application 233
Participating in Persistence 234
Creating the Extension 234
PersistenceParticipant 235
AddComment Activity 235
GetComments Activity 237
Modifying the Workflow 237
Accessing the Extension from the Application 237
Event Handler Syntax 238
Running the Application 239
CHAPTER 13 Tracking 247
Setting Up the Solution 247
Copy Solution from Chapter 12 248
Setting Up the Database 248
Tracking Participants 248
ListBoxTrackingParticipant 248
Overriding the Track() Method 250
Configuring a Tracking Participant 251
Configuring a Tracking Profile 252
WorkflowInstanceQuery 253
BookmarkResumptionQuery 253
ActivityStateQuery 253
CustomTrackingQuery 254
CustomTrackingRecord 254
Running the Application 256
Event Tracing for Windows (ETW) 256
Setting Up the Extension 256
Configuring the TrackingProfile 257
Running the Application 257
SqlTrackingParticipant 259
Setting up the Database 259
Implementing the SqlTrackingParticipant 261
Configuring the Tracking Participant 263
Running the Application 265
CHAPTER 14 Transactions 273
Setting Up the Solution 273
Assignments 274
Adding the LINQ to SQL Class 274
AssignLead Activity 276
RuntimeTransactionHandle 278
CreateAssignment Activity 278
Application Changes 280
Updating the List of Leads 280
Removing Database Updates 281
Adding Workflow Event Handlers 282
Workflow Changes 290
TransactionScope 291
InvokeMethod 291
Running the Application 294
CHAPTER 15 Transactions with Persistence 295
Setting Up the Solution 295
PersistenceParticipant 296
PersistLead Extension 296
Connecting to the Database 299
Performing the Updates 299
Using the PersistLead Extension 299
Modifying the CreateLead Activity 300
Modifying the AssignLead Activity 301
PersistAssignment Extension 302
Using the PersistAssignment Extension 304
Application Changes 305
Running the Application 305
CHAPTER 1 6 WorkflowServiceHost 306
Setting Up the Solution 306
Adding LeadResponse 307
Renaming the Window 308
Defining the Window Form 308
Copying Classes from LeadGenerator 311
Implementing the Application 311
WorkflowService 317
Behaviors 318
DBExtensionBehavior 318
PersistAssignmentBehavior 320
Defining the Workflows 321
CompleteAssignment 321
EnterLead Workflow Modifications 322
WorkAssignment Workflow 325
Persist 328
Final Application Changes 328
ApplicationInterface 328
Adding the app.config File 329
LINQ Conflict 330
Running the Applications 331
Review 333
PART 5 Advanced Topics 334
CHAPTER 17 Compensation, Confirmation, and Cancellation 335
Designing the Workflow 336
Modifying the Application 336
Configuring a TryCatch Activity 338
Using a Parallel Activity 339
CompensableActivity 340
Designing the Wedding Activity 341
Designing the Reception Activity 343
Designing Confirmation Activities 344
Designing the Invitations Activity 344
Designing the Confirmation Activities 345
Running the Application 346
Cancellation Handlers 347
More on the Parallel Activity 347
Designing Compensation Handlers 348
Designing the Wedding Compensation 348
Designing the Reception Compensation 349
Running the Application 350
Customizing Compensation and Confirmation 353
Adding the Token Variables 353
Setting the Result Property 355
Custom Confirmation 355
Custom Compensation 357
Rethrow Activity 358
CHAPTER 18 Collections 361
Creating a Collection 361
Defining the Shopping List 362
Initial Workflow 362
AddToCollection Activity 364
Invoking a Workflow 364
Running the Application 365
Printing and Sorting 365
Printing the Collection 365
Sorting the Collection 367
Searching the Collection 369
Overriding the Equals() Method 369
ExistsInCollection Activity 370
RemoveFromCollection Activity 371
ClearCollection Activity 371
CHAPTER 19 Interoperability with Workflow 3.5 377
Creating a 4.0 Workflow 377
Creating a 3.5 Workflow 378
Interop Activity 382
Running the Application 383
Executing a Custom 3.5 Activity 383
Creating a Custom Activity 384
Throwing an Exception 386
Invoking the Custom Activity 387
Running the Application 390
CHAPTER 20 Policy 391
Creating a Custom Activity 391
Defining the Data Structures 392
PolicyActivity 395
Adding Dependency Properties 396
Creating a Rule Set 399
Defining the Rules 400
Understanding Rule Sets 403
Rules 403
Chaining 404
Halt and Update 405
Rules File 405
Determining the Priority 406
Entering the Priority Rules 407
Creating a Workflow Application 408
Creating a Custom Activity 409
Incrementing the Activity Counters 412
Creating the Main Workflow 416
Configuring the Arguments 416
Implementing the Console Application 418
Running the Application 419
Review 419
APPENDIX Sample Workflow Project 421
Project Overview 421
Configuring the Database 421
Running the Application 422
Logging In 423
Submitting a Request 424
Processing Requests 425
Tracking the Workflow 429
Generic Queue Logic 429
Database Design 430
Activities 431
CompleteInstance 431
QCPolicy 432
Tracking 434
Service Layer 436
Service Contract 436
Database Design 438
Activities 439
Workflow Design 440
SubmitRequest 441
Processing a Request 443
Correlation 444
Using WorkflowServiceHost 446
Writing Extensions 447
Configuring Extensions 450
Configuring Persistence 450
Configuring Tracking 451
Summary 453
Index 454

Erscheint lt. Verlag 5.5.2010
Zusatzinfo 500 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Programmiersprachen / -werkzeuge NET Programmierung
Mathematik / Informatik Informatik Software Entwicklung
Mathematik / Informatik Informatik Theorie / Studium
Mathematik / Informatik Informatik Web / Internet
Schlagworte collections • Database • Exception Handling • .NET Framework • Technology • Web Services • Windows Communication Foundation • Windows Workflow Foundation
ISBN-10 1-4302-2486-X / 143022486X
ISBN-13 978-1-4302-2486-0 / 9781430224860
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 4,6 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Expert-backed advice for information system design, down to .NET and …

von Jean-Philippe Gouigoux

eBook Download (2024)
Packt Publishing (Verlag)
38,39
Build practical projects with Blazor, .NET MAUI, gRPC, GraphQL, and …

von Mark J. Price

eBook Download (2023)
Packt Publishing (Verlag)
35,99