views:

101

answers:

1

Has any one done that ? I'm planning to use a state machine workflow from WF 4.0 as the navigation framework ...
The idea is as follows
1. States correspond to pages. Grouping some states into composite states for anonimous/authorised requests
2. A custom controller factory intercepts the requests, extracts the controller/action names and some other data and calls the workflow runtime passing those
3. The workflow runtime executes some stuff, makes a transition to a new state and passes back the new state's name as well as other data needed for the view rendering
4. Based on the received information, the controller factory creates the corresponding controller etc
I'm trying to think of some eventual pitfalls of that design ...

A: 

There where a number of examples using WF3 doing this sort of thing but I haven't seen any for WF4. I don't know enough about the ASP.NET MVC internals to give any specific details on how to implement this but I suppose it is possible to do. However it means running the workflow synchronously and checking the bookmarks and/or active state as soon as it becomes idle to see which operations are enabled at the moment. That should be possible using a custom SynchronizationContext that does things synchronous. A custom TackingParticipant should be able to tell you what state switched occurred in the workflow.

Maurice