Search code examples
workflow-foundation-4

Terminating workflow without loading it into memory


I have long running workflow which is persisted into database using SqlWorkflowInstanceStore, the problem is if I don't use WorkflowApplication.Load before terminating a workflow instance nothing is deleted from the persistence database and according to msdn calling WorkflowApplication.Load will "Load the specified workflow instance into memory from an instance store." Why is workflow behaving this way?


Solution

  • You can delete the workflow records from the instance store yourself. In fact Windows Server AppFabric has a menu option to do exactly that.

    You terminate a workflow instance object you have in memory. WorkflowApplication.Load() is not affecting that, it is making it possible. Without loading it from the store you don't have an instance in memory to call terminate on (unless you just started it of course).