Kieron
Kieron

Reputation: 27117

Windows Workflow Foundation example - moderation

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.

Upvotes: 2

Views: 4769

Answers (4)

Richard
Richard

Reputation: 109080

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).

Upvotes: 1

casperOne
casperOne

Reputation: 74540

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

Upvotes: 3

ahsteele
ahsteele

Reputation: 26504

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.

Upvotes: 3

Dave Swersky
Dave Swersky

Reputation: 34810

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.

Upvotes: 3

Related Questions