Occurs when the state of a workflow instance is persisted.
Assembly: System.Workflow.Runtime (in System.Workflow.Runtime.dll)
The workflow instance can be persisted for many reasons. For example, the host can call WorkflowInstance.UnLoad on a workflow instance, or the workflow run-time engine can persist a workflow instance because the instance is idle or because an atomic scope has completed. If a persistence service is present in the WorkflowRuntime, is raised by the runtime after the state of the workflow instance is saved to memory. If a persistence service is not present, the event is still raised but the instance state is not saved. If the event occurs because the workflow instance is being unloaded, it is followed by a WorkflowUnloaded event.
For more information about handling events, see Consuming Events.
The following code example demonstrates how you can use WorkflowRuntime functionality from a workflow host. The code associates the with an event handler, a method named OnWorkflowPersisted.
This code example is part of the Custom Persistence Service Sample.