Using the Workflow Foundation in MVC3 to process page flow (as in the Wizard)

I want to separate the MVC web pages and their display order. Actually, I think these are scenarios that I need to solve, but I am very fixated on a certain way of thinking. I just want to find a template or object that will help control the flow.

Page sequence example:

  • Redirect only: the user can only move forward through the workflow until it ends.
    - Special case: if the user navigates to or incorrectly enters the wrong URL, the system should respond accordingly (redirect to the current step)

  • Forward - Back (read-only): the user can go through the wizard, but the "Back" button allows you to view only previous read-only data.

  • Forward - Backward (reading a record): the user can go back and update data in previous records. This can cause the workflow to reset in the previous state.

In those moments when the user can enter into more than the “correct state”, the front concept above should correspond to this (for example, on a state machine)

Question:

How to implement this page control flow in MVC3 / WF4 application?

enter image description here

+4
source share
2 answers

I explored this idea. In my opinion, the Workflow Foundation will be worth it if your process takes a long time (for example, days).

Otherwise, you will find that writing some kind of custom code (such as State Machine) is much easier than trying to enable the Workflow Foundation.

However, if you are looking for examples, here is one: http://code.msdn.microsoft.com/Windows-Workflow-233b5e3c/sourcecode?fileId=22211&pathId=1790082120

+3
source

We ourselves consider architecture similar to your proposal. Part of MVC is basically automatic code with ASP.NET Llblgen Pro + templates, so we want to control the business logic (and page workflow) from another place.

We are still studying the final solution, and WF 4.0 is one of the candidates (since it is quite easy to create a library of reusable activities), but the Stateeless state machine looks very simplified and easier to maintain. We already have an ORM-generated persistence level, so you should not resume a suspended workflow in the future for a long time. Take a look at Stateless and let us know if this is suitable.

An example is explained: http://blogs.msdn.com/b/nblumhardt/archive/2009/04/16/state-machines-in-domain-models.aspx

Activated VS 2010 code with examples: https://github.com/haf/Stateless

+4
source

All Articles