Search code examples
visual-studio-2010.net-4.0workflowworkflow-foundation-4state-machine

Generating State Machine using .Net framework dynamically


I am trying to model a given Problem using State Machine (.Net framework 4.0 update 1) and am wondering, if i can add new States to State machine in the run time?

I wanna model a street strukture as a State Machine. User will define his destinations on map which i want to use as states for the state machine.

Any help!!


Solution

  • Here is a blog post by @RonJacobs where he created a prototype of a library that could do this a lot more straight forward - you might want to check that out.

    http://blogs.msdn.com/b/rjacobs/archive/2011/06/08/creating-a-state-machine-in-code.aspx

    Here is a blog post by him that is creating a workflow in code, the state machine wouldn't be much different, it would just leverage different accessors at the root.

    http://blogs.msdn.com/b/rjacobs/archive/2011/06/22/authoring-activities-in-code-or-xaml.aspx

    And here's yet another one that shows how you could load the workflows from the database.

    http://blogs.msdn.com/b/rjacobs/archive/2011/06/15/how-to-load-wf4-workflow-services-from-a-database-with-iis-appfabric.aspx