views:

317

answers:

5

If I have a State Machine created in version 3.5 will I be able to upgrade to .Net/WF 4.0, or will I have to re-create the functionality? I heard / read that 4.0 does not support State Machines. Finally, if you have a State Machine in 3.5, what is your plan for migrating to 4.0?

+1  A: 

It is correct that WF4 will not support statemachines. However, the 3.5 engine is available so you can run your code in .net 4 but without new features ofcourse.

adrianm
In other words the 4.0 compiler won't bark at 3.5?
David Robbins
+1  A: 

Workflow 4 whilst not formally supporting the State machine activity does so because its no longer necessary. You can still implement that same functionality using a Flowchart.

I've been using 3.5 up till now but WF4 will make things much simpler.

AnthonyWJones
Would I be correct in assuming that a 3.5 State Machine would need to be re-architected for 4.0? In other words, 4.0 does NOT automatically "thunk" down to the 3.5 level?
David Robbins
@David: Correct, WF4 runtime is quite different and represents a clean break from 3.5. The upside is that the original 3.5 workflow runtime, activities etc are still available in .NET 4 so its possible to run old and new workflows side-by-side. However if you want to use the WF4 engine you will need re-engineer the workflows.
AnthonyWJones
+2  A: 

That a state machine workflow is no longer needed in WF4 is not quite true.

Most, but not all, state machine scenarios are easier to model in a WF4 flowchart. That is the case because most developers used state machine because sequential was not flexible enough. All those cases, and those are probably a majority, are well covered by the flow chart.

However the event driven state machine examples are much harder in WF4. Check the WF4 State Machine Guidance here for more details. And the team at Microsoft has announced they are planning on releasing a state machine for WF4 after the initial version ships with .NET 4.

Maurice
Thanks for the info. I recently implemented Stateless by Nicholas Blumhardt for the reason that 4.0 was approaching and, from my reading at the time, MS would not be providing a state machine.I invite you to look at Stateless - it is much, much simpler that WF State Machine. http://code.google.com/p/stateless/
David Robbins
+1  A: 

Since the runtime is different in WF4, you need to use the Interop Activitiy for backward compatability with 3.5 and 3.0 workflow applications. And yes, State machine workflow is not yet supported in WF4.

Derar
A: 

CBT is released for WWF 4.0 under codeplex.

WWFUser