locked
Persisting a Wizard Workflow RRS feed

  • Question

  • Hi,

    I am new to WF4 and would like some advice on the following:

     

    I have a website with a 'Wizard' process and it would be useful to have the system save each step as they complete (there are a few different steps and the user may start this process, but realise they dont have all the info and need to return later).

    Each step in the process could map to a "entity" which could be persisted, but it would be desirable to not save the temporary entities (i.e. those generated from an incomplete wizard).

     

    Therefore I though WF would be useful and am trying to figure out if a persisted WF would fit my needs.

    I imaging the process to be:

    Have a WF similar to that here:

    http://channel9.msdn.com/Shows/Workflow-TV/endpointtv-WF4-in-the-Real-World-Microsoft-Support-ASPNET-MVC-Wizard-Framework

    The WF takes a WF context, which wraps a model for the wizard.

    If the user leaves the wizard, the WF will persist (after a timeout, with all of the variables - is this possible??)

    Each time the user clicks "next" the WF context will be updated.

    On completion of the WF the WF model will be fully validated and persisted.

    -----------------------

     

    The problems I see tho - how to get the list of all "In flight" workflows

    How to retreive the data from the flow...

     

    I am not looking for a full solution - just a little guidance on any pitfalls.. is it possible to persist all variable.. is it recommended etc..

     

    Thanks!

    km

     

     

     

     

     

     

     

     

     

    Tuesday, January 17, 2012 9:42 AM

All replies

  • Hi,

    ->If the user leaves the wizard, the WF will persist (after a timeout, with all of the variables - is this possible??)

    Yes, when a WorkflowApplication becomes idle and the PersistableIdle property of the application is set to PersistableIdleAction.Persist, it will be persisted.

    http://msdn.microsoft.com/en-us/library/dd489420.aspx

    ->The problems I see tho - how to get the list of all "In flight" workflows
    ->How to retreive the data from the flow...

    You can configure workflow tracking and tracing to get the “in flight” workflows, and you can retrieve the data either by using tracking or custom PersistenceParticipant.

    Workflow Tracking and Tracing
    http://msdn.microsoft.com/en-us/library/ee513992(VS.110).aspx

    Store Extensibility
    http://msdn.microsoft.com/en-us/library/ee364726(VS.110).aspx

    How to: Deserialize Instance Data Properties
    http://msdn.microsoft.com/en-us/library/ee960223.aspx

    Hope this information helps, thanks.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, January 19, 2012 7:07 AM
  •  

     

    Thanks for the help Leo,

     

    I have followed this example and modified it to have each step update a collection of models (stored as a WF variable).  The collection is a simple dictionary of string/object where the string key is the step name.

    On the callback for each step, the lates model is sent in as a parameter and the collection updated (each step is a NativeActivity derived actrivity).

    I thought this would work well, but my trouble now is still regarding the retreival of the saved model.  When I resume the WF, my applications "resumuption" methodloads the WF application and returns the bookmark name to the calling code (which is then used to determine which view we render).  It is at this point it would be useful to get the correct model (if any). 

     

    I will look into the custom PersistenceParticipant and hopefully will get it working.

     

    On a side note - is this a bad idea to begin with?  The reason for looking at this is that we do not wish to use the main DB - as some entities may not be pesistable until the wizard is complete.

    Also - there could be many of these wizards so a easy to roll out solution would be useful.  However - I know very little about WF (as you can tell!) - are there performance issues I should be concerned about?  Any other pitfalls I should be aware of?

     


    Thursday, January 19, 2012 9:49 AM