Kirk Evans Blog

.NET From a Markup Perspective

Wow! I Finally Think I Get Workflow!

I have been talking about Windows Workflow Foundation since last PDC.  I have done countless demos, showing off basic workflow authoring, creating very simple custom activities, creating rules, using XAML for workflows, even scoping transactions.  Typically, I will add a SqlWorkflowPersistenceService to the WorkflowRuntime and add a handler for the WorkflowIdled event where I unload the workflow instance, which gets fired when a TimerActivity is executing.  Neat and all, but I was missing the biggest part…

I received a review copy of Darma Shukla and Bob Schmidt’s Essential Windows Workflow Foundation.  I know quite a bit about developing workflows, so I didn’t think I would get much out of the first few chapters.  I couldn’t have been more wrong. 

The first chapter starts out writing a simple Console app, same as I do for my presentations.  However, the author takes a different approach at explaining the same code, showing how the challenge is that the app sits for an unspecified period of time waiting for input from the user.

This is not something I ever effectively showed in my demos, and I wasn’t exactly sure how to accomplish it.  Within the first 2 chapters of this book, I get it.  I get the concept of a WorkflowQueue, I get that queues are tied to WorkflowInstances and not the runtime.  And now I get how an activity and a service go hand-in-hand with each other, how to obtain a specific service to leverage some of its functionality from within an Activity.

If you are looking at Windows Workflow Foundation, then this book is an absolute must.  Honestly, it’s that good.  Within 2 chapters, and an entire new set of concepts was opened up to me that I was completely ignorant of before this book.  This book is much more valuable than 90% of the samples or Hands On Labs that you have probably worked with because it shows how to wait for user input.  Clearly. 

This book just made my top list of must-read books.   

Now I want to go back and take a mulligan on just about every WF demo that I have done in the past year, just to show how to passivate a workflow while it waits on user input.  I promise that I will show a variation of this activity will be shown at every talk I do on WF from here on out.