OdeToCode IC Logo

State Machines In Windows Workflow

Sunday, September 24, 2006

A new article on OdeToCode: State Machines In Windows Workflow. State machines have been a powerful abstraction in software for many years. Using a state machine in Windows Workflow means we get all the tracking, persistence, and meta-data support the workflow runtume offers, which is quite a bonus.

The state machine designer

Lars Klitgaard Wednesday, September 27, 2006
This walkthrough was extremely informative to me. I am a novice programmer currently looking into .NET 3.0 to see what it can do for me when creating the new application, I am heading for.
This explanation has a clear goal and cuts all the technical details and extreme usage scenarios away and only describes the basic therminology and behavior from a common-known, simple example - and it does it at a speed and level so even I feal confident with it.
Good job !
Francesco Wednesday, September 27, 2006
Hi Scott,

We added your nice (as usual) article to the WF Section of NetFXGuide.

Pete Sunday, October 8, 2006
Can I get the code associated with this article (please)?
scott Monday, October 9, 2006
Pete: Send me an email (scott at odetocode.com)
Jay Tuesday, October 10, 2006
Scott, this is nice one. I have a query similar on this line, if you can guide me.

I have already running a bug tracking system which is non windows workflow based.

If I want to implement such bug tracking system using windows workflow, how should I handle my earlier bugs which have their own states (e.g. Open/ Resolved/ Need more clarification/ Closed) while creating this workflow based bug tracking system?
scott Tuesday, October 10, 2006

You can force a state using the StateMachineInstance class. After you start the workflow, create a new instance (StateMachineWorkflowInstance instance =
new StateMachineWorkflowInstance(runtime, instanceID)) and use the SetState method. It's like an administrative override.
Rahul Jain Thursday, November 2, 2006
This article is really kool man :)

Rahul Jain
George Tuesday, November 7, 2006
This was a great summary !!!
Great example topic too because every engineer is familiar with all the states of a bug.

Mswlogo Friday, November 10, 2006

After looking a little more closely I'm a bit confused why you call the last part of your article Hierarchical State Machines. If it was truely hierarchical how would one introduce yet a third level. It appears to allow you to inherit one level of event handling from a base "group of events", and that's it. It's definitely useful, but I don't think it's called hierarchical state machines.

I'd like to understand how hierarchical state machines could be built with WF (if it's even possible).
Harlan Friday, October 16, 2009
Gravatar GCoder Tuesday, November 17, 2009
Do you have the source code for the article?
Gravatar scott Tuesday, November 17, 2009
Gravatar Kalyan Wednesday, December 9, 2009

This is very usefull article, can you please send me the source code.

Thanks and Regards
Gravatar Kalyan Wednesday, December 9, 2009
Hi Scott,

Can you please check the link, it is not working.

Thanks and Regards,
Gravatar ruwanthaka Tuesday, December 15, 2009
yes, looks like it's not working!
Tiju Tuesday, December 22, 2009
good job.
Gravatar Sandeep Tuesday, January 19, 2010
Hi Scott,
this is a very useful article for WF. thank you very much for writing and sharing such a valuable article.
Gravatar Om Sunday, January 31, 2010
I was looking from last few months,what are uses of WWF and how to implement it. but only this artical answered all my quries regarding Workflow.
Great work........
Gravatar Muruganandam Selvaraj Monday, February 15, 2010
Hi Scott,


This link not working. where I can download source code for this article?. Please help me.
Gravatar Muruganandam Selvaraj Monday, February 15, 2010
Hi Scott,


This link not working. where I can download source code for this article?. Please help me.
Gravatar Labhesh Monday, February 22, 2010
I have some problem with sequention workflow. could you please help.
I am deploying my workflow on custom list. this workflow runs on custom content type which is inheritaing from windows task content type.

but when I am trying to run this workflow it is showing error , till add & I run Sharepoing inbuild workflow. like approval or something else workflow.

why my workflow is dependent on sharepoint in-build workflow. ??

Help please.

Gravatar Gayathri Natarajan Monday, February 22, 2010
really superb article.i too want the example something like that.

can u give me the full code of this example.
Gravatar Rene Incer Wednesday, March 3, 2010
Nice Article!!
State Machine are explained so plenty.
Only one question...
How can you do to inheritance event driven to certain States and not all? (that was you did in the last part of example)
Gravatar Deepthi Friday, March 5, 2010
This is very good article. can you please send me the source code.
In our project the host is asp.net website.
when i try to call more than one methods(communication by local service)
under one button click event ,error occurs like below

Event "Insert" on interface type "statemachine.Interface1" for
instance id "8dfec02f-7395-4f9c-b3a6-a410cddaefb9" cannot be delivered.

Is it possible to call more than one methods in one click event?
Gravatar Gaurav Tuesday, May 11, 2010

Great article. Is there a way I can download the code? The link does not seem to work. The Bug class implementation is missing, so I was wondering if this is part of the code download.

Tom Monday, June 28, 2010
Great thing you did !
Really helped me to dive into WF State Machines.
maisa Thursday, July 8, 2010
thank u alot .But why you use Bug as a data type ? Is there data type called (Bug)in C#?
Gravatar suresh Tuesday, August 10, 2010
Hi Scott,


The link provided is not working, can you please provide me the source code link..

Gravatar Bikram Keshari Deb Saturday, August 14, 2010
Hey Scott,

I tried understanding WF before an year. I wasn't able to do so then. This article made me so confident today that I'm gonna have this WF stuff in my current project and I am gonna handle it.

Thanx a bunch.....
Gravatar Mark Dakers Monday, October 18, 2010
Great article, helped my understanding a lot thanks.
Comments are closed.