views:

1183

answers:

4

Hi,

As part of my Personal Improvement Program (PIP™), I'm trying to learn the basics of Windows Workflow Foundation.

I decided to write a fairly simple blogging engine. I know there are tonnes out there, but this is just a playground project I can use for learning some cool stuff. One of the main features I wanted to implement is the moderation of blog entries using WF. The rest of the project is going to be an ASP.NET MVC app, possibly sprinkled with a little WCF.

From what I've read about WF, I should be using a sequential workflow that should look something like this:

  1. Author adds/ edits blog entry.
  2. Entry gets sent to moderator for approval.
  3. Moderator approves post -- or -- back to item 1. for author to correct, along with moderator notes.
  4. Finish

Every step should also e-mail the receiptiant of the action.

Because of the human interaction factor, I'm guessing the WF runtime would need to serialise itself somewhere so it doesn't loose state (as each activity could be interrupted by AppPool resets, server crashes etc).

Does anyone know of any good examples or places that implement a similar workflow?

Thanks all.

+3  A: 

I would hold off on delving into WW for the time being. .NET 4.0 is going to introduce changes to the model of WW to address current pain points. These changes will introduce a model that is fundamentally different from WW today, and learning the current methodologies for WW will not be as helpful if you don't already have a WW solution in place.

More information can be found here:

http://blogs.msdn.com/endpoint/archive/2009/01/20/the-road-to-wf-4-0-part-1.aspx

casperOne
As that article states, the 3.0 stuff will still ship with 4.0 so it'll continue to work. Plus, I think it'll still be worth learning the 3.0 version as some companies are still using Visual Studio 2005 - like the company I'm contracting for ATM...no plans on upgrading anytime soon /:
Kieron
-1 there is nothing stating that 4.0 is breaking. 3.0 will work with a required change to host it in the provider. The core skills and understanding of how wf works in 3.0 will still be valid for 4.0.
Robert MacLean
+3  A: 

You're on the right track. Windows Workflow provides a persistence model that allows you to save the state of a running workflow instance to a SQL Server. When a running instance is paused (usually while waiting for input from outside the workflow) the state is automatically serialized to the database.

Here is a starter kit from Microsoft for web-based approval workflows.

Dave Swersky
Good find on the approval starter kit, thanks...not sure how I missed that. +1
Kieron
+1  A: 

serialise itself somewhere so it doesn't loose state

WF has inbuilt support for this (using SQL Server, but you can plugin a different backend).

Any decent resource should cover workflow persistence (e.g. "Pro WF" (APress) does).

Other books (e.g. "Essential Windows Workflow Foundation" (AW)) cover more of the "why does it work this way". So "Pro WF" will get you using the inbuilt (or other off the shelf) activities etc. quicker, but Essential... will likely lead to you having a better understanding to create your own Activities (especially when it comes to interacting with persistence and faults).

Richard
Thanks for the book advice, was looking at Pro WF, but wasn't sure. I'll add it to my Amazon list (:
Kieron
'Essential Windows Workflow Foundation' is mis-titled: should've been called 'Fiddly bits of WF you won't need to know til you've been using it for a year'. Plus it reads like a computer science book - i.e. no attempt on the part of the authors to make it accessible.
serialhobbyist
+3  A: 

I am not sure you want to use a sequential workflow. A state machine workflow is probably more applicable to your needs. Rinsing and repeating in a sequential workflow always seems a bit cumbersome IMHO.

I like the workflow tutorials on Ode to Code and think the tutorial on state machine workflows will answer a lot of your questions.

ahsteele