How to NOT persist a workflow instance when it is completed?

I've found when a workflow instance is completed, it will be persisted automatically. Is that true If yes, how to get rid of it


Answer this question

How to NOT persist a workflow instance when it is completed?

  • lucerias

    I have already let UnloadOnIdle be false ---- because I do not want to persist my workflow each time it becomes idle.
    Strangely, it is still persisted when it is about to complete. I do not want this because it overwrites the previous persistence (I am using a custom file persistence service). Thus, I want the workflow to be persisted only when I tell it to be.

  • JazW

    Thanks.
  • UnknownScripter

    The workflow instance is persisted each time you indicate to the runtime to unload or when the workflow becomes idle. To me, the last time a workflow is persisted, can happen anytime the workflow meets the criteria above, and just before it is about to complete. Just curious...why are you trying to avoid persistence for the last time, before a workflow completes

    Bayer



  • comspy

    If there is a persistence service registered with the runtime the runtime will call WorkflowPersistenceService.SaveWorkflowInstanceState when a workflow instance completes or terminates. This doesn't mean that your persistence service is required to save the instance state. For example the SqlWorkflowPersistenceService does not serialize the instance at this point. All it does is delete the row from it's database. A persistence service can check the status of the instance by calling WorkflowPersistenceService.GetWorkflowStatus(rootActivity); in it's SaveWorkflowInstanceState method.

    Thanks,

    Joel West

    MS SDE in WF runtime and hosting

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


  • h1

    But before the workflow is removed, it will be persisted for the last time, no
    What I mean is how to avoid this last time persistence.

  • TersiaMG

    Check the state of your workflow for when you call WorkflowInstance.Unload() .

    Bayer



  • WidgetWorking

    If you have added a persistence service, then once the Workflow is completed it is removed from the persistence store.

    Bayer



  • How to NOT persist a workflow instance when it is completed?