The Problem SolverWIndows Workflow Foundation
HomeShow ChangesEditPrintRecent ChangesSubscriptionsLost and FoundFind ReferencesRename



26-9-2007 16:26:48

List all versions

Persist On Close

If you are developing your own WorkflowActivities make sure you take a good look at the PersistOnClose attribute! If your activity does any work like changing a database its more than likely that you don’t want to have the action executed twice. If the WorkflowRuntime is stopped after your activity has completed without this attribute and is restarted later it will be restarted at the last persisted point, which is before your activity. The result being that your activity is executed again, not quite what you had in mind . The PersistOnClose attribute makes sure that the workflow state is persisted as soon as the activity has completed resulting in a consistent state even after a restart.

Of course the PersistOnClose attribute has a drawback and that is that the workflow runtime requires a Workflow persistence service, something you don’t always want. In that case a WorkBatch might be your friend. With a WorkBatch the actual work is postponed until the workflow reached a PersistencePoint. And the end of the workflow is always a PersistencePoint

Wiki Usage

This wiki site is supposed to be a shared resource. As a shared resource everyone is encouraged to add new content or modify existing content!

Enjoy the WF wiki.

Recent Topics

  • PersistOnClose