locked
Manually Persisting to Instance table as like PersistableIdleAction.Unload RRS feed

  • Question

  • I have a workflow inside a transaction so the code in this is hanging on WaitOne() call where I am calling context.CreateBookmark method.

    Since the workflow in not completed (syncEvent.set() is not called) transaction is not getting completed.

    But I want to persist the workflow execution until the bookmark part, if I do that by calling syncEvent.Set() on

    wfApp.PersistableIdle = delegate(WorkflowApplicationIdleEventArgs e)
    {
        idleEvent
    .Set();
       
    return PersistableIdleAction.Persist;
    };

    it is not creating a record in InstanceTable. So I want to persist the workflow manually to InstaceTable or a better way to implement this.

    I am using flowchart type workflow


    Sunday, May 29, 2011 6:15 PM

Answers

  • Hi,

    ->"But I want to persist the workflow execution until the bookmark part, if I do that by calling syncEvent.Set() on"
    Have you tried Persist activity. Please note that you cannot persist workflow in a non-persist scope. for example, it is not allowed to persist a workflow between Receive and Send pair.

    Regards
    MSDN Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This posting is provided "AS IS" with no warranties, and confers no rights. My Blog: http://xhinker.com
    Microsoft Windows Workflow Foundation 4.0 Cookbook
    • Marked as answer by Andrew_Zhu Monday, June 20, 2011 10:02 AM
    Thursday, June 2, 2011 8:24 AM
  • Since you are using System.Transactions.TransactionScope, you may want to use WorkflowInvoker. It works with C# TxScope by making sure that activities scheduled in worker thread are executed in the ambient transaction. Please check this article for more info: http://msdn.microsoft.com/en-us/library/dd759027.aspx

     

    Best Regards,

    Leo

    This posting is provided "AS IS" with no warranties, and confers no rights.

     

     

    • Marked as answer by Andrew_Zhu Monday, June 20, 2011 10:02 AM
    Friday, June 3, 2011 4:56 PM

All replies

  • Hi,

    ->"But I want to persist the workflow execution until the bookmark part, if I do that by calling syncEvent.Set() on"
    Have you tried Persist activity. Please note that you cannot persist workflow in a non-persist scope. for example, it is not allowed to persist a workflow between Receive and Send pair.

    Regards
    MSDN Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This posting is provided "AS IS" with no warranties, and confers no rights. My Blog: http://xhinker.com
    Microsoft Windows Workflow Foundation 4.0 Cookbook
    • Marked as answer by Andrew_Zhu Monday, June 20, 2011 10:02 AM
    Thursday, June 2, 2011 8:24 AM
  • Since you are using System.Transactions.TransactionScope, you may want to use WorkflowInvoker. It works with C# TxScope by making sure that activities scheduled in worker thread are executed in the ambient transaction. Please check this article for more info: http://msdn.microsoft.com/en-us/library/dd759027.aspx

     

    Best Regards,

    Leo

    This posting is provided "AS IS" with no warranties, and confers no rights.

     

     

    • Marked as answer by Andrew_Zhu Monday, June 20, 2011 10:02 AM
    Friday, June 3, 2011 4:56 PM