Search code examples
asp.net-mvc-4workflow

Approval Process in MVC Application


I am working on a system, where user changes data and submit for changes. Now we are thinking to introduce work flow, means going to introduce approval process for the data submission. somebody is going to approve the data. until the data modification is not approved, it shouldn't be saved in the database.

  1. Does anybody had idea about workflows in web applications?
  2. Our application involves editing in multiple tables, how we are going to store the data while approval process is in.

Thanks, -Naren


Solution

  • There are a number of options but most will revolve around storing the data in an temporary state (database tables, XML documents, JSON data structure, etc.) and then persist once the workflow has reached conclusion. There are many complications that can arise from this such as; poisoned transactions, out of sequence processing, timeouts in the workflow process and changes to workflow while processing just to name a few. I suspect that you will want to use some form of orchestration process (BizTalk, ESB, NServiceBus, Windows Workflow, etc.).

    If you are wanting to manage the workflow by hand.

    Live table

    [dbo].[MyTable] (
        -- columns here
    )
    

    Processing table. Once the workflow process is complete you would copy the data from the processing table to the live table.

    [dbo].[MyTableInProcess] (
        -- identical columns as MyTable
        , [State]
        , [ApprovingUser]
        , [DateProcessCommenced]
    )
    

    Note that this implementation is extremely crude and needs a lot of work to be considered production ready, but will hopefully get you on the right path.