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?
[130 byte] By [wolfkrow] at [2007-12-22]
# 1

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

Bayer

BayerWhite at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
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.
wolfkrow at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

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

BayerWhite at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
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.

wolfkrow at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

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

Bayer

BayerWhite at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 6

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

JoelWest at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 7
Thanks.
wolfkrow at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified