[ ] square brackets, 58
Aborted delegate, WorkflowApplication class and, 128
aborting activities, 693
aborting workflows, 849
AbortInstanceOnTransactionFailure property (TransactionScope activity), 540
Action delegate (C#), 127, 197
Action property (PickBranch activity), 105
activities, 2–44, 71–110, 849. See also workflows
aborting, 693
activity definition vs. activity instance, 55
activity properties and, 634–645
activity templates for, 683–685
adding to Visual Studio Toolbox, 301
categories of work and, 47, 72
child. See child activities
command-line calculator sample application illustrating. See command-line calculator (sample application)
composite, 74
creating, workflow designer and, 756
custom. See custom activities
data flow of, 99
declarative activity model and, 45
defined, 2
executing individually, 40
Hello Workflow sample application illustrating, 5–17
life cycle of, 55
metadata store for, 633, 640–642
parent. See parent activities
standard. See standard activities
state and, 57
as synonymous with workflows, understanding, 46, 55
using, 97
WF 3.x, executing from Interop activity, 801, 806–842
workflow declaration and, 8–12, 17
Activities assembly, 7
DynamicActivity class and, 142, 741–747
shipping charges calculator sample application and, 89
activity templates, 683–685, 767
ActivityAction activity, 290–302
activity templates and, 683
ActivityAction class, 195, 290, 849
delegates and, 290
properties of, 291
supporting ActivityAction and, 657
scheduling ActivityAction and, 734
ActivityBuilder class, 756, 765, 849
ActivityContext class, 56, 485, 849
ActivityDefinitionId property (TrackingProfile class), 575
ActivityDelegate class, 850
ActivityDesigner class, 630, 850
ActivityInfo class, 571
ActivityInstance class, 56, 691, 850
ActivityMetaProperties property (Interop activity), 806
ActivityProperties property (Interop activity), 806
ActivityScheduledQuery, 577
ActivityScheduledRecord, 572, 577, 598
ActivityState class, 572
ActivityType property (Interop activity), 806
ActivityValidationServices class, 661, 663, 680
ActivityXamlServices class, 142–144
AddBaseAddress method, 362
AddExtension method (WorkflowApplication class), 129
AddImplementationVariable method, 715
addition case, Switch activity and, 30
AdditionalConstraints property (ValidationSettings class), 663, 680
addresses, endpoints and, 316
AddServiceEndpoint method, 362
AddToCollection activity, 101, 109, 198
AddToDictionary activity, 214, 215
AddValidationError method, 667
AdventureWorks SQL Server sample database, 508–529
downloading/installing, 509
LINQ to SQL for accessing, 510
tracking workflows and, 579
Annotations property (TrackingRecord class), 568
annotations, to tracking records, 568, 597
anonymous functions, Lambda expressions and, 93
credit approval sample workflow service and, 400
order processing sample workflow service and, 344, 346, 359
order shipment sample workflow service and, 384, 388
self-hosting workflow services and, 366
shopping cart sample workflow and, 440, 455, 464
tracking profiles read from, 575, 623–626
WorkflowControlEndpoint and, 480
debugging, 37
external, guidelines for workflow interaction with, 266
quitting, 36
running. See running applications
workflow persistence and, 416
ArgExpression argument, 25, 235
argument properties, 21
ArgumentException, 21
activity data flow and, 99
DesignerHost sample application, 796
dictionaries and, 118
properties and, 118
shipping charges calculator sample application and, 84
Arguments button (workflow designer), 10, 18
ArgumentToExpressionConverter class, 631, 637
arithmetic operations, Switch activity and, 29
ASP.NET web applications, invoking workflows from, 145–149
assemblies, 51
expressions and, 632
vs. InvokeMethod activity, 222
AsyncCodeActivity class, 47, 73, 76, 850
inventory lookup sample and, 189
shipping charges calculator sample application and, 94
suspending persistence and, 419
AsyncCodeActivityContext class, 56
asynchronous unit of work, 73, 850
atomic unit of work, 73, 411, 850
Attributes property (ActivityBuilder class), 756
AutoResetEvent, 123, 125, 134, 273
generic/nongeneric versions of, 76
HostingDemoActivity sample and, 121
BasicHttpBinding, 340
BeginCancel method, WorkflowApplication class and, 132
BeginExecute method
inventory lookup sample and, 190
shipping charges calculator sample application and, 94
BeginInvoke method, 486
shipping charges calculator sample application and, 95
WorkflowInvoker class and, 113, 122, 124
BeginInvokeCallback method, 125
BeginLoad method (WorkflowApplication class), 130
BeginOnLoad method (PersistenceIOParticipant class), 471
BeginOnSave method (PersistenceIOParticipant class), 471
BeginPersist method (WorkflowApplication class), 130
BeginResumeBookmark method (WorkflowApplication class), 132
BeginRun method (WorkflowApplication class), 130, 140
BeginTerminate method (WorkflowApplication class), 132
BeginTrack method (TrackingParticipant class), 605
BeginTryCommand (InstanceStore class), 484, 486
BeginUnload method (WorkflowApplication class), 132
behaviors
workflow services and, 412
WorkflowServiceHost persistence and, 443
bindings, 851
endpoints and, 316
migration and, 805
properties and, 297
Web.config file and, 342
workflow services and, 316
Body property
CancellationScope activity, 108, 564
ParallelForEach activity, 196
TransactionScope activity, 540
BookmarkCallback delegate, 267
BookmarkOptions enum, 692, 747
BookmarkResumptionQuery, 577
BookmarkResumptionRecord, 572, 577
BookmarkResumptionQuery and, 577
BookmarkResumptionRecord and, 572
long-running unit of work and, 74
migration and, 805
parent/child activities and, 692
Pick/PickBranch activities and, 302–312
shopping cart sample workflow and, 429
workflow instances and, 131
Boolean conditions, evaluating/testing, 690, 702, 726
Branches property (Parallel activity), 105, 176
branching decisions
decision-making constructs for, 164
procedural modeling style and, 2, 3, 29
breakpoints, 37
building blocks, workflows and, 97
C#
expression support for, 68
C# events, vs. delegates, 128
CacheMetadata method, 658, 851
configuring metadata and, 688
CallExternalMethodActivity
ExternalDataExchangeService and, 823
Interop activity and, 807, 823
Cancel method, 463
child cancellations and, 693
WorkflowApplication class, 132, 137
CancelChild method (NativeActivityContext class), 693, 728
CancelChild method (NativeActivityFaultContext class), 692
CancelChildren method (NativeActivityContext class), 693
CancelHandler property (CancellationScope activity), 108
cancellation requests, 693
CancellationHandler property
CancellationScope activity, 564
CompensableActivity, 549
CancellationScope activity, 101, 108, 564
CancelRequestedQuery, 577
CancelRequestedRecord, 572, 577
CanInduceIdle property, 267, 269
case sensitivity, Visual Basic and, 59
cases, arithmetic operations and, 30
Cases property (Switch activity), 165
Catches property (TryCatch activity), 109, 530
ChannelFactory class, 317
child activities, 9
ActivityScheduledRecord and, 572, 598
cancelling, 693
CancelRequestedQuery and, 577
CancelRequestedRecord and, 572
exception handling for, 709–714
execution completion and, 691
execution properties and, 748
execution repeated for, 702–709
execution scheduling for, 690, 693–702, 714–725, 857
Parallel activity and, 176, 194
parallel execution for, 725–734
Sequence activity and, 176
single/multiple, 649–657, 667–683
Switch activity and, 85
ClearCollection activity, 101, 109, 198, 218
ClearDictionary activity, 214, 217
client applications, implementing, 342–348
Close method (WorkflowServiceHost class), 362
Closed delegate, WorkflowApplication class and, 137
Closed event (WorkflowServiceHost class), 362
Closing event (WorkflowServiceHost class), 362
CLR (Common Language Runtime). See runtime
CLR data types, variables and, 56, 75, 90
Code Activity template, 23
CodeActivity class, 23, 46, 64, 73, 851
access to the workflow runtime and, 76
migration and, 804
shipping charges calculator sample application and, 78
WF 3.x workflows and, 821
CodeActivityContext class, 24, 56
collapsed viewing mode, 645–649
collection activities, 198–211
collection category (of standard activities), 109
Collection property
AddToCollection activity, 109, 198
ClearCollection activity, 199
ExistsInCollection activity, 199
RemoveFromCollection activity, 198
collection-related activities, 195–228
CollectValues method (PersistenceParticipant class), 470
command-line calculator (sample application)
ActivityAction used with, 293–302
alternate extension used with, 286–289
flowchart modeling style and, 233–241
hosting workflows and, 34
ParseCalculatorArgs activity for, 23, 27, 234, 236
procedural modeling style and, 22–43
running, 35
workflow extensions used with, 276–286
Common Language Runtime. See runtime; CLR data types, variables and
CommunicationObject class, 361
CompensableActivity, 101, 108, 549–557
Compensate activity, 101, 108, 550, 557
compensation, 50, 549–563, 852
CompensableActivity and, 549–557
compensation handlers and, 57
compensation activities (WF 3.x), Interop activity and, 807
CompensationHandler property (CompensableActivity), 549
Completed delegate, 127, 128, 273
CompletionCondition property
Parallel activity, 105, 176, 188, 194
ParallelForEach activity, 196
CompletionCallback callback delegate, 691
CompletionState property, 134
complex types, controlling serialization of, 323
composite activities, 9, 74, 852
composition, 852
Condition property, 106
Boolean conditions and, 702
child activity scheduling and, 714
If activity, 164
ConfigurationManager class, 623
configuring workflow services, 316
Confirm activity, 101, 108, 550
ConfirmationHandler property (CompensableActivity), 549
consistency of database updates
TransactionScope activity for, 541–546, 549
Console class, 13
Constraint class, 662
Constraints property (ActivityBuilder class), 663, 756
constraints, for validation, 662, 669–679, 852
Content property, messaging activities and, 323, 324
content-based correlation, 325, 386–388, 852
ContentControl class, 630
ContentPresenter class, 648
context-based correlation, 369–385, 852
vs. content-based correlation, 325
guidelines for, 370
Context property (WorkflowDesigner class), 754, 757
ContextMenu property (WorkflowDesigner class), 754
control flow activities, 74, 852
control flow category (of standard activities), 104
controlling, 325
workflow services and, 324
CorrelationHandle, 325
CorrelationInitializer class, 325
CorrelationScope activity, 101, 107, 326
CreateBookmark method (NativeActivityFaultContext class), 267, 692
CreateInstanceStore method, 436
CreateWorkflowOwnerCommand, 421, 422, 444, 485
credit approval (sample) workflow service, 388–405
order processing sample workflow service modified for, 394–399
custom activities, 23, 46, 71, 687–752
adding to Sequence activity, 28
asynchronous implementation for, 93–97
authoring, ways of/steps for, 72, 78, 97
cancelling, 564
code authoring for, 78–84, 88–93
custom tracking records and, 600–604
CustomTrackingRecord for, 573
dictionary-related activities and, 213–222
expression activities and, 64–66
flowchart modeling style and, 248–253
LINQ queries/updates and, 511–520
migration and, 804
order processing sample workflow service and, 349
for shopping cart sample workflow, 428
tracking workflows and, 580
unit testing for, 39
workflow building blocks and, 97
workflow extensions and, 406
CustomTrackingQuery, 578
CustomTrackingRecord, 573, 578
data
categories of, activities and, 74
data contracts and, 315, 322, 330, 852
workflow persistence and, 419
data flow of activities, 99
data types, C# vs. Visual Basic, 61
DataContract attribute, 315, 322, 331, 419
DataMember attribute, 315, 322, 331, 419
debugging applications, 37, 48
decisions, 2, 22–38, 164, 233–241
declarative activity model, 45, 853
declarative workflow model, 2
declarative workflow services, tracking workflows and, 618–623
Default case, Switch activity and, 30, 32, 36
Default property (Switch activity), 165
definition, 55
adding to a workflow, 180
Parallel activity and, 177
SqlWorkflowInstanceStore persistence and, 422
TimeSpan value and, 120
workflow persistence and, 418
vs. C# events, 128
multiple instances of workflows and, 152
WorkflowApplication class and, 127
DeleteWorkflowOwnerCommand, 421, 422, 485
shopping cart sample workflow and, 437
WorkflowServiceHost and, 444
commenting out for testing purposes, 642
using vs. metadata store, 642
DesignerHost (sample) application, 760–799
context menu, modifying for, 793–796
controls for, 761
currently selected activity, tracking, 790–793
Save/SaveAs/Open operations and, 775–777
steps for implementing (list), 760
DesignerMetadata class, 760, 764, 788
associating with activities, 633, 639–642
default, 636
shipping charges calculator sample application illustrating, 635–649
steps for creating (list), 634
design-time
custom activities and, 629–685
design-time audience and, 72
developers, activities and, 72
dictionaries
dictionary-related activities for, 213–222
DisplayName property, 12
division case, Switch activity and, 31
domain-specific languages, workflow model and, 2
DoWhile activity, 101, 104, 165, 174, 632
downloads
AdventureWorks SQL Server sample database, 509
sample code for Pro WF (in .NET 3.5) book, 824
sample code for this book (Pro WF in .NET 4.0), 761
duplex message exchange pattern, 315, 388–405, 853
correlation and, 324
guidelines for, 389
durable delay, 853
DurableInstancingOptions property, 362
DynamicActivity class, 77, 142, 741–747, 853
DynamicActivityProperty class, 743
e-commerce shopping cart (sample) workflow. See shopping cart (sample) workflow
Else property (If activity), 104, 164
EditingContext class, 757, 853
EndExecute method
inventory lookup sample and, 191
shipping charges calculator sample application and, 94, 96
EndInvoke method, 486
inventory lookup sample and, 191
shipping charges calculator sample application and, 96
WorkflowInvoker class, 113, 122, 124
EndOnLoad method (PersistenceIOParticipant class), 471
EndOnSave method (PersistenceIOParticipant class), 471
EndRun method (WorkflowApplication class), 130, 141
EndTrack method (TrackingParticipant class), 605
EndTryCommand (InstanceStore class), 484, 486
Enqueue method (WF 3.x), migration and, 805
EnqueueOnIdle (WF 3.x), migration and, 805
error handling category (of standard activities), 109
ETW (Event Tracing for Windows), 68, 565, 578, 853
ETW tracking participant, 579–591
EtwTrackingParticipant class, 277, 578
event logging, 578
Event Tracing for Windows (ETW), 68, 565, 578, 853
event tracking, EtwTrackingParticipant for, 277, 578
EventData element, tracking data and, 589
events
custom, migration and, 805
vs. queues, 286
EventTime property (TrackingRecord class), 568
examples. See samples
Executing state, 57
exception handling, 50, 57, 507–530
ArgumentException and, 21
FaultPropagationQuery for, 577
FaultPropagationRecord for, 573
multiple exceptions and, capturing, 537
parents/children and, 692, 709–714
Throw activity and, 32
unhandled exceptions and, 507
workflow services and, 409
command-line calculator sample application and, 24
inventory lookup sample and, 168
shipping charges calculator sample application and, 79, 94, 810
Executing state, 853
ExistsInCollection activity, 101, 109, 198, 201
ExistsInDictionary activity, 214, 216
expanded viewing mode, 645–649
Expression property
FlowSwitch activity, 106
designer classes and, 631
Expressions namespace, 63
ExpressionTextBox class, 631, 637, 651
Extensible Application Markup Language. See Xaml
Extensions property (WorkflowApplication class), 129
ExternalDataExchange attribute, 823
ExternalDataExchangeService, WF 3.x and, 823–834, 854
FaultCallback callback delegate, 691
Faulted event (WorkflowServiceHost class), 362
FaultPropagationQuery, 577
FaultPropagationRecord, 573, 577
file system
file-based instance stores and, 485–492, 501
workflow persistence and, 417, 484
FileSystemInstanceStore (sample) class, 485, 492
FileSystemInstanceStoreIO (sample) class, 485, 492–501
Finally property (TryCatch activity), 109, 530, 537
FindInCollection activity, 199, 201, 255
FindInDictionary activity, 214, 217
FirstNumber argument, 24–28, 30
Flowchart activity, 9, 101, 105, 230, 854
command-line calculator sample application and, 233
flowchart category (of standard activities), 105
flowchart modeling style, 3, 47, 163, 229–263, 854
mixing with procedural modeling style, 229, 254–263
using 230–233
FlowchartDecision activity, 230, 231
FlowchartStep activity, 230, 232
FlowchartSwitch activity, 230, 231
FlowDecision activity, 102, 106, 854
FlowNode class, 230
FlowSwitch activity, 102, 106, 854
Flush method (WorkflowDesigner class), 754, 772
ForEach activity, 102, 105, 195, 200–211, 254
activity templates and, 683
ActivityAction activity and, 734
ActivityAction class and, 197, 657
foreach keyword (C#), 195
ForEachWithBodyFactory class, as activity template, 683, 767
Func delegate, 89, 95, 127, 486
GenericTypeArguments property (InvokeMethod activity), 223
generic types, C# vs. Visual Basic, 59
GetAdditionalExtensions method (IWorkflowInstanceExtension interface), 278
GetBookmarks method (WorkflowApplication class), 132
GetChildSubtree class, 672
GetExtension method (WorkflowApplication class), 129, 277
GetExtensions method (WorkflowApplication class), 129
GetParentChain class, 672, 675
GetWorkflowTree class, 672
globally unique identifiers GUIDs), workflow instances and, 137
guessing game (sample) application, 824–834
GUIDs (globally unique identifiers), workflow instances and, 137
HandleExternalEventActivity
ExternalDataExchangeService and, 823
Interop activity and, 807, 823, 807, 823
HandleFault method (NativeActivityFaultContext class), 692, 712
Hello Workflow (sample application), 5–17
adding new workflows to, 17
running, 14
hosting workflow services, 49
credit approval sample workflow service and, 400
order processing sample workflow service and, 359
order shipment sample workflow service and, 384
Xaml workflows and, 326
Xamlx workflow services and, 326
hosting workflows, 48
command-line calculator sample application and, 34, 239
Hello Workflow sample application and, 12, 20
HostingDemoActivity sample illustrating, 121
HostingDemoWorkflow sample illustrating, 117
WebInvokerHost and, 147
WorkflowApplication class and, 126–142
WorkflowInvoker class and, 111–126
Xaml workflows and, 326
HostingDemoActivity (sample), 121
HostingDemoWorkflow (sample)
ActivityXamlServices class and, 143
hosting the workflow, 117
multiple workflow instances and, 150
WorkflowApplication class and, 133
WorkflowInvoker class and, 114–120
workflows invoked from ASP.NET web applications and, 145
human interactions, 855
workflow model and, 2
workflow persistence and, 416
IActivityTemplateFactory interface, 683
icons, 643
Idle delegate, 127, 128, 137, 273
Idle member, PersistableIdle member and, 420
IEquatable interface, 201, 202
problem reporting sample workflow and, 303
shipping charges calculator sample application and, 85, 90
if keyword, 48
if statement (C#), 85
IIS (Internet Information Services), 316
publishing workflow services to, 341
workflow persistence and, 416
images, 643
imperative code, migration and, 804
Implementation property
Activity class, 89
ActivityBuilder class, 756
Imports button (workflow designer), 10
InArgument class, 21, 24, 75, 90
inferred contracts, 324
infrastructure, work categories and, 74
initialization syntax, vs. procedural code, 742
Initialize method/Uninitialize method (WF 3.x), migration and, 805
InitializeCorrelation activity, 102, 107
InitializeDesigner method, 764, 779
instance methods, WorkflowInvoker class and, 112, 122–126
instance stores, 416, 483–505, 855
InstanceId property (TrackingRecord class), 568
InstanceInfo class (C#), 154, 156
InstancePersistenceCommand class, 484
InstancePersistenceContext class, 485
InstanceStore class, 416, 484, 485, 855
InstanceStore property, 130, 420, 443
InstanceView property (InstancePersistenceContext class), 485
IntelliSense, 19
Internet Information Services (IIS), 316
publishing workflow services to, 341
workflow persistence and, 416
Interop activity, 51, 102, 110, 806–842, 855
ExternalDataExchangeService and, 823–834
limitations of, 807
migration and, 804
shipping charges calculator sample application illustrating, 807–823, 834–842
WF 3.x activities, executing from, 801, 806–842
Interop class, 806
InteropTrackingRecord class, 574, 807
inventory lookup (sample), 241
hosting/testing, 172
Parallel activity and, 182–194
While/DoWhile activities and, 167–175
inventory update (sample), 200–213, 254–263, 508–564
custom activities for, 511–530
dictionary-related activities and, 218–222
executing, 526
InvokeMethod activity and, 223–227
ParallelForEach activity and, 211
tracking workflows and, 579–605, 611–626
InvokeAction activity, 290, 300
InvokeAction class, 290
InvokeAsync method (WorkflowInvoker class), 113, 122
InvokeCompleted event, 123
InvokeFunc class, 290
InvokeMethod activity, 102, 108, 222–227
InvokeWorkflowActivity, Interop activity and, 807
IsCancellationRequested property, 704
IsolationLevel property (TransactionScope activity), 540
Item property
AddToCollection activity, 109, 198
RemoveFromCollection activity, 198
Items property
EditingContext class, 757
ExistsInCollection activity, 199
ItemSupportExtension (sample) custom workflow extension, 426, 472–474
IValidationErrorService interface, 777
IWorkflowInstanceExtension interface, 278
keywords, C# vs. Visual Basic, 59
Lambda expressions, 90, 93, 855
Language INtegrated Query (LINQ), 93, 855, 510
Level property (TrackingRecord class), 568
LINQ (Language INtegrated Query), 93, 855, 510
Literal class, 58
literal data types, C# vs. Visual Basic, 62
Load method
resuming persistence after suspending, 420
WorkflowApplication class and, 130, 417
WorkflowDesigner class and, 754, 755
Xaml and, 142
LoadWorkflowByInstanceKeyCommand, 485
LoadWorkflowCommand, 485
local services, 823
long-running unit of work, 73, 855
long-running workflows, 265, 327
cancelling, 564
WorkflowControlEndpoint for, 479–483
looping decisions, 165
procedural modeling style and, 2, 3, 34
flowchart modeling style and, 241–248
MapValues method (PersistenceParticipant class), 470
message-based communication. See workflow services
message contracts, 323, 330, 856
message exchange patterns, 315, 317, 856
MessageBodyMember attribute, 323, 324, 331
MessageContract attribute, 323, 324, 331
MessageHeader attribute, 323, 324, 331
MessageReceived event, ExternalDataExchangeService and, 831
messaging activities, 317–322, 324
messaging category (of standard activities), 106
metadata
configuring automatically/manually, 688–690
custom instance stores and, 490–498
DesignerMetadata class and, 760, 764, 788
MetadataStore class and, 633, 760, 856
MetadataStore class, 633, 760, 856
MethodName property (InvokeMethod activity), 223
migration category (of standard activities), 110
migration strategies, 51, 801–806
ModelChanged event (WorkflowDesigner class), 754, 764
modeling styles. See flowchart modeling style; procedural modeling style
ModelItem property (ActivityDesigner class), 630, 638
multiplication case, Switch activity and, 31
Name property
ActivityBuilder class, 756
TrackingProfile class, 575
naming conventions
for assemblies, Visual Studio and, 640
for service contracts, 319
NativeActivity, 856
NativeActivity class, 74, 266, 291
access to the workflow runtime and, 76
configuring metadata and, 688
executing activities and, 694
NativeActivityContext class, 56, 267, 291
cancellation requests and, 693
child activity execution scheduling and, 690
execution properties and, 747
suspending persistence and, 419
NativeActivityFaultContext class, 692
NativeActivityMetadata struct, 689, 735
.NET Framework
examples in this book and, 6
projects and, 6
nonblocking bookmarks, 747, 748
nonflowchart activities, 232
nonpersisting tracking participants, 615–618
NonSerialized attribute, workflow persistence and, 419
nonworkflow applications, implementing, 342–348
NoPersistHandle class, suspending persistence via, 419
notification to external systems, 509, 517, 551
object initialization, C# vs. Visual Basic, 59
Of keyword, 59
OnComplete method, 695, 704, 727
OnConditionComplete method, 703, 715
one-way message exchange pattern, 315, 856
OnUnhandledException delegate, 128, 135, 273
OnUnhandledException method, 507, 527, 529
Open method (WorkflowServiceHost class), 362
Opened event (WorkflowServiceHost class), 362
Opening event (WorkflowServiceHost class), 362
OperationContract attribute, 324
operators, C# vs. Visual Basic, 59
order processing (sample) workflow service, 313, 328–368
client application for, 342–348
configuring/testing, 339
credit approval sample workflow service and, 388–405
execution properties and, 747–751
order shipment sample workflow service and, 369–388
response for, populating, 337
workflow extensions and, 405–409
order shipment (sample) workflow service, 369–388
order processing sample workflow service modified for, 379–383
OrderEntry (sample) workflow
configuring/testing and, 440
declaring, 431
OrderEntryService (sample) workflow service
client application and, 458
declaring, 445
promoting properties and, 476–479
OrderUtilityExtension (sample), 406–409
order processing sample workflow service modified for, 407
testing, 409
orphaned workflow instances, 443
OverloadGroup validation attribute, 662, 664
Parallel activity, 102, 105, 176–188
asynchronous execution via, 189
child activities and, 176, 194
parallel execution, 176, 189, 725–734, 856
ParallelForEach activity, 102, 105, 211
ActivityAction class and, 197
vs. ForEach activity, 196
ParallelForEachWithBodyFactory activity, 767
parameters, passing to workflows, 17–22
Parameters property (InvokeMethod activity), 223
parent activities
cancelling, 693
constrained activities and, 674
exception handling for, 709–714
execution properties and, 748
validation and, 678
ParseCalculatorArgs (sample) activity
implementing in command-line calculator sample application, 234, 236, 269
unit testing for, 39
performance
argument properties and, 22
collection-related activities and, 199
Persist activity, 102, 107, 417
Persist method (WorkflowApplication class), 130, 417, 420
PersistableIdle delegate, WorkflowApplication class and, 128, 136
PersistableIdle member, 420, 438, 442
PersistableIdle property, WorkflowServiceHost and, 443
persistence, 3, 49, 415–467, 857
arguments/variables and, 75
configuring/managing, 129
defined, 415
execution properties and, 747
how it works, 417
migration and, 807
nonpersisting tracking participants and, 615–618
persistence commands (list), 484
reasons for using, 415
resuming after suspending, 420
SqlWorkflowInstanceStore and, 421–467
suspending, 419
tracking participants and, 604–614
WorkflowApplication and, 419, 424–443
WorkflowServiceHost and, 443–467
PersistenceIOParticipant class, 471
PersistenceParticipant class, 419, 469, 472–474, 857
Pick activity, 102, 105, 302–312, 371, 378
PickBranch activity, 102, 105, 371, 378
PolicyActivity class, 834, 842
Presentation namespace, 753
primitives category (of standard activities), 107
problem reporting (sample) workflow, 303–312
procedural activities, 163–194, 230
procedural code, vs. initialization syntax, 742
procedural modeling style, 3, 47, 163, 857
branching decisions and, 2, 3, 29
mixing with flowchart modeling style, 229, 254–263
projects
creating, 6
running, 15
Promote method (SqlWorkflowInstanceStore class)
properties
activity properties and, 634–645
binding, 297
execution properties and, 747–751
Properties property (ActivityBuilder class), 756
Properties window, 11
PropertyInspectorView property (WorkflowDesigner class), 754, 755
PropertyReference activity, 297
proxy classes, client applications and, 316, 344
PublishValues method (PersistenceParticipant class), 470
Queries property (TrackingProfile class), 575
Query method, 463
Queue class, 286
queues, 286
quitting applications, 36
credit approval sample workflow service and, 394
inferred contracts and, 324
Interop activity and, 807
SendReply activity and, 319
WCF and, 317
ReceiveAndSendReply activity, 102, 106, 683
ReceiveAndSendReply activity template, 319
ReceiveMessageRecord, 574
ReceiveReply activity, 317, 321
RecordNumber property (TrackingRecord class), 568
referencedCategories dictionary, 781
reflection, activity metadata and, 690
Register method (DesignerMetadata class), 760, 788
RemoveFromCollection activity, 102, 109, 198
RemoveFromDictionary activity, 214, 215
RenderingInfo element, tracking data and, 589
request/response message exchange pattern, 315, 857
correlation and, 325
order processing sample workflow service and, 327–368
RequiredArgument validation attribute, 662, 663
RequiredArgumentAttribute, 24
resources, workflow persistence and, 416
resources for further reading
Lambda expressions, 93
LINQ, 511
WCF, 314
WF 3.x, 811
WPF, 629
Result argument, 25
Result property
ExistsInCollection activity, 199
InvokeMethod activity, 223
RemoveFromCollection activity, 198
ResumeBookmark method, 267
resuming persistence after suspending, 420
WorkflowApplication class and, 132
root (topmost) activity, 9
custom activities and, 842–847
Run method
resuming persistence after suspending, 420
WorkflowApplication class and, 130, 151
RunAsynchronously property (InvokeMethod activity), 223
running applications
command-line calculator sample application and, 35
Hello Workflow sample application and, 14, 21
runtime, 851
activity definition vs. activity instance, 55
ActivityAction class and, 290
DynamicActivity class and, 741
private variables and, 56
runtime category (of standard activities), 107
samples
command-line calculator. See command-line calculator (sample application)
credit approval workflow service, 388–405
DesignerHost application, 760–799
FileSystemInstanceStore class, 485
FileSystemInstanceStoreIO class, 485, 492–501
guessing game application, 824–834
HostingDemoWorkflow. See HostingDemoWorkflow (sample)
inventory lookup, 167–175, 182–194, 241
inventory update. See inventory update (sample)
ItemSupportExtension custom workflow extension, 426, 472–474
order processing workflow service. See order processing (sample) workflow service
order shipment workflow service, 369–388
OrderEntryService workflow service, 445, 458, 464
OrderUtilityExtension, 406–409
problem reporting workflow, 303–312
sample code for this book, downloading, 761
shipping charges calculator. See shipping charges calculator (sample application)
shopping cart workflow, 424–467
Save method (WorkflowDesigner class), 754
SaveWorkflowCommand, 485
scalability, workflow persistence and, 416
ScheduleAction method (NativeActivityContext class), 291, 690, 734
ScheduleActivity method (NativeActivityContext class), 690, 695, 727
scheduledChildren dictionary, 726
ScheduleDelegate method (NativeActivityContext class), 690, 734
ScheduleFunc method (NativeActivityContext class), 291, 690, 734
SecondNumber argument, 24–28, 30
self-hosting workflow services
steps for implementing, 361–368
testing/using, 367
WorkflowApplication class and, 416
WorkflowServiceHost class and, 416, 422
Send activity, 102, 106, 317, 320
Interop activity and, 807
ReceiveReply activity and, 321
SendAndReceiveReply activity, 102, 106, 683
SendAndReceiveReply activity template, 322
SendMessageRecord, 574
SendReply activity, 317, 319, 324
Sequence activity, 9, 102, 104
child activities and, 176
command-line calculator sample application and, 233
custom designers and, 653
Parallel activity and, 179
shipping charges calculator sample application and, 90
testing constraints and, 677
serializing tracking records to XML, 605–608
service contracts, 315
endpoints and, 316
naming conventions for, 319
service operations, order processing sample workflow service and, 327–368
ServiceContract attribute, 324
ServiceHostBase class, 361
ServiceModel Metadata Utility (svcutil.exe utility), 316
Services property (EditingContext class), 757
SetChildrenCollection method, 715
SetInstance method (IWorkflowInstanceExtension interface), 278
shipping charges calculator (sample application), 78–97
custom activity asynchronous implementation for, 93–97
custom activity code authoring for, 78–84, 88–93
custom activity designers and, 635–649
custom activity Xaml authoring for, 84–88
flowchart modeling style and, 248–253
project for, 79
unit testing for, 81–84, 87, 92, 96, 251
validation and, 663
WF 3.x activities and, 807–823
WF 3.x workflows and, 815–823, 834–842
shopping cart (sample) workflow, 424–467
item-related classes for, 425
tasks for implementing (list), 424, 444
workflow implementation for, 424–443
workflow service implementation for, 444–467
ShowValidationErrors method, 777
SOAP fault handling, workflow services and, 409
SqlWorkflowInstanceStore, 421–467
Delay activity and, 422
properties of, 421
SQL Server preparation for, 423
using with WorkflowApplication, 424–443
using with WorkflowServiceHost, 444–467
SqlWorkflowInstanceStore class, 53, 416, 443
property promotion and, 474–479
workflow persistence and, 420
SqlWorkflowInstanceStoreBehavior class, 454, 456
Delay activity and, 423
workflow persistence and, 422
WorkflowServiceHost persistence and, 443
square brackets [ ], serializing expressions and, 58
standard activities, 3, 46, 71, 101–110
Interop activity and, 807
list of, 101
WF 3.x vs. WF 4 (table), 865–868
workflow building blocks and, 97
standard flow activities, 9
state
activities and, 57
ActivityState class and, 572
ActivityStateQuery and, 576
ActivityStateRecord and, 571
tracking profiles and, 592–596
tracking workflows and, 569
static methods, WorkflowInvoker class and, 111, 114–122
String class, 19
string literals, 11
subtraction case, Switch activity and, 31
SuspendActivity, Interop activity and, 807
svcconfigeditor.exe (WCF Service Configuration Editor), 342
svcutil.exe utility (ServiceModel Metadata Utility), 316
Switch activity, 29, 102, 104, 164
FlowchartSwitch activity and, 231
shipping charges calculator sample application and, 85, 90
switch statement (C#), 29, 104, 165, 231
SynchronizationContext class, InvokeAsync method and, 113
SynchronizationContext property (WorkflowApplication class), 130, 160
System element, tracking data and, 589
system-provided bindings, WCF and, 316
Target property (Compensate activity), 550
TargetObject property (InvokeMethod activity), 223
TargetType property (InvokeMethod activity), 223
templates, 6
Terminate method (WorkflowApplication class), 132, 139
TerminateWorkflow activity, 102, 107
terminating activities, 693, 858
text, WriteLine activity for, 10
Text property
WorkflowDesigner class, 754, 755
TextWriter property
HostingDemoWorkflow sample and, 114
WriteLine activity and, 108
Then property (If activity), 104, 164
Timeout property (TransactionScope activity), 540
timeout values, 119
TimeToPersist property (WorkflowIdleBehavior class), 444
TimeToUnload property (WorkflowIdleBehavior class), 444, 454
ToolboxCategory class, 755
ToolboxControl class, 755
ToolboxItemWrapper class, 755, 768
topmost (root) activity, 9
Track method (TrackingParticipant class), 578, 605, 609
Tracking namespace, 600
tracking participants, 566, 578, 604–618, 858
tracking profiles and, 574
tracking profiles, 566, 574–578, 591–604, 858
loading from App.config file, 623–626
targeting selected activities and, 596
tracking records, 566, 568–574, 858
tracking participants and, 578
tracking profiles for, 574, 591
viewing tracking data and, 587, 623
tracking workflows, 50, 565–627, 858
architecture of the workflow tracking mechanism, 566
declarative workflow services and, 618–623
migration and, 807
reasons for using, 566
SQL Server and, 68
steps for implementing (list), 567
viewing tracking data and, 579, 586, 623
TrackingParticipant class, 578, 605
TrackingProfile class, 574, 575
TrackingProvider class, 566
TrackingRecord class, 568
TransactedReceiveScope activity, 103, 107, 412, 541
transaction and compensation category (of standard activities), 108
transactions, 50, 540–549, 858
host transactions and, 547
workflows/workflow services and, 411
TransactionScope activity, 50, 103, 108, 411, 540–546
TransactionScope class, 540
transport protocol, identified by binding, 316
Trigger property (PickBranch activity), 105
Try property (TryCatch activity), 109, 530
try/catch blocks, 35, 531, 549
TryCatch activity, 103, 109, 410, 530–540
multiple exceptions and, capturing, 537
properties of, 530
TryCommand (InstanceStore class), 484, 488
Uniform Resource Identifier (URI), endpoint addresses and, 316
Unload method (WorkflowApplication class), 132
Unloaded delegate, WorkflowApplication class and, 128, 137
URI (Uniform Resource Identifier), endpoint addresses and, 316
using statement (C#), 10
Validate method (ActivityValidationServices class), 661, 663, 680
mechanisms for (list), 662
validation attributes for, 662, 663–666
validation code for, 662, 667–669
validation errors, displaying, 777
ValidationContext property, 672
ValidationSettings class, 663, 680
value expressions, 632
Values property
ParallelForEach activity, 196
Variable Editor, 27
activity data flow and, 99
shipping charges calculator sample application and, 85
shopping cart sample workflow and, 431, 445
Variables button (workflow designer), 10, 26
Variables Editor, 26
VB (Visual Basic), for expressions, 57–62, 859
versioning, 803
View property (WorkflowDesigner class), 754, 755
viewing modes, expanded/collapsed, 645–649
visibility, 565
Visual Basic (VB), for expressions, 57–62, 859
Visual Studio
.NET Framework and, 804
unit testing and, 39
WF 3.x and, 802
WF and, 4
workflow designer and. See workflow designer
Visual Studio debugger, 48
VisualBasicReference class, 58
VisualBasicValue class, 58
warnings, validation and, 669
WAS (Windows Process Activation Service), 316
WCF (Windows Communication Foundation), 48, 314–317, 859
message exchange patterns and, 315, 317
WCF contracts and, 67
WF integration with, 3
workflow services and. See workflow services
WCF Service Configuration Editor (svcconfigeditor.exe), 342
WCF Test Client (WcfTestClient.exe), 342
web service activities, Interop activity and, 807
Web.config file
declarative workflow services and, 620
enhancing for workflow services publishing to IIS, 341
WF (Windows Workflow Foundation), 859
base classes and, 23
creating workflow in, 15
features missing from version 4.0 of, 66
features/capabilities of, 45–51
migration strategies for, 51, 801–806
reasons for using, 3
variable scope and, 27
WF 3.x vs. WF 4 (table), 861–868
While activity, 103, 104, 165–175
custom designers and, 650
WorkflowItemPresenter/WorkflowItems Presenter classes and, 632
while keyword, 48
Windows Communication Foundation. See WCF
Windows Event Viewer, 579, 586, 623
Windows Presentation Foundation (WPF) applications, 131, 160, 629
Windows Process Activation Service (WAS), 316
Windows Server AppFabric, 316
Windows Workflow Foundation. See WF
work categories, activities and, 72
workflow clients, implementing, 348–361
Workflow Console Application template, 6, 23, 235
architecture/components of, 753–760
DesignerHost sample application illustrating, 760–799
interface of, 10
rehosting, 51
Visual Studio and, 47
workflow extensions, 49, 276–286, 859
adding to workflows, 409
alternate extension and, 286–289
implementing, 406
workflow persistence and, 419
workflow projects
creating, 6
running, 15
workflow services, 48, 313–414, 860
behaviors and, 412
configuring, 316
controlling instances of, 327
correlation and, 324
credit approval sample workflow service and, 388–405
exceptions/faults and, 409
hosting, 316
message types and, 322
messaging activities for implementing, 317–322
order processing sample workflow service. See order processing (sample) workflow service
order shipment sample workflow service. See order shipment (sample) workflow service
OrderEntryService sample workflow service and, 445, 458, 464
publishing to IIS, 341
transactions and, 411
WCF contracts and, 67
workflow instances, identifying, 325
workflow tracking. See tracking workflows
workflow workflow, 4
WorkflowApplication class, 49, 57, 126–142, 860
creating instances of, 127
Delay activity and, 418
delegate members and, 127
GetExtension method and, 277
handling unhandled exceptions and, 507
ResumeBookmark method, 267
SqlWorkflowInstanceStore used with, 424–443
workflow extensions and, 277
workflow instance execution and, 130
workflow persistence and, 416, 419
vs. WorkflowInvoker class, 126, 273
WorkflowControlClient class, 480
WorkflowControlEndpoint, 479–483
tasks for implementing, 480
testing and, 482
WorkflowControlEndpoint class, 57, 443
WorkflowDesigner class, 754, 860
WorkflowExtensions property, 362, 405
WorkflowIdleBehavior class, 413, 443, 454
WorkflowInstanceQuery, 576
WorkflowInstanceRecord, 569, 576, 592
WorkflowInstanceStates class, 570
WorkflowInvoker class, 13, 49, 111–126, 267, 860
BeginInvoke method for, 113, 122, 124
EndInvoke method for, 113, 122, 124
executing activities via, 121
host transactions and, 547
instance methods for, 112, 122–126
Invoke method for, 111
InvokeAsync method for, 113, 122
static methods for, 111, 114–122
unhandled exceptions and, 507
workflow extensions and, 277
workflow persistence and, 416
vs. WorkflowApplication class, 126, 273
WorkflowItemPresenter class, 632, 651, 655, 660
WorkflowItemsPresenter class, 632, 655
WorkflowQueue (WF 3.x), migration and, 805
aborting, 849
activity data flow and, 99
activity definition vs. activity instance, 55
asynchronous execution and, 126
bookmarks and, 131
building blocks and, 97
controlling workflow instances and, 132
declarative activity model and, 45
declarative workflow model and, 2
dynamic updates, WF 3.x and, 68
examples of. See samples
flowchart modeling for, 229–263
hosting. See hosting workflows
invoking from ASP.NET web applications, 145–149
long-running, 265, 327, 479–483
mental checklist for, 4
multiple instances of, managing, 150–161
orphaned workflow instances and, 443
parallel execution, multiple activities and, 725–734
persistence and. See persistence
procedural modeling for, 163–194
reasons for using, 1
resumption of after becoming idle, 113
activities and. See activities; custom activities
stopping execution of, 132, 137
synchronous execution and, 148
timeout values for, 119
tracking. See tracking workflows
transactions and, 411
understanding as synonymous with activities, 46, 55
workflow extensions and, 129, 409
Xaml workflow services and, 326
Xaml workflows and, 326
WorkflowServiceHost
workflow persistence and, 443–467
WorkflowControlEndpoint and, 480
WorkflowServiceHost class, 49, 361, 443, 860
Delay activity and, 423
ExternalDataExchangeService and, 823, 831
multiple workflow instances and, 150
workflow persistence and, 416, 422
WorkflowExtensions property, 362, 405
Xamlx workflow services and, 326
WorkflowUnhandledExceptionBehavior class, 57, 412
WorkflowViewElement class, 630
WPF (Windows Presentation Foundation) applications, 131, 160, 629
WriteLine activity, 10, 103, 108
HostingDemoWorkflow sample and, 114
inventory lookup sample and, 188
ActivityXamlServices class and, 142–144
authoring activities and, 72
breakpoints and, 38
Xaml workflows, 326
Xamlx workflow services, 326, 860
XML, serializing tracking records to, 605–608
xmln:s attribute, 637
xmlns:sapc attribute, 637
3.137.163.197