Redigera

Dela via


WorkflowRuntime.WorkflowPersisted Event

Definition

Occurs when the state of a workflow instance is persisted.

public:
 event EventHandler<System::Workflow::Runtime::WorkflowEventArgs ^> ^ WorkflowPersisted;
public event EventHandler<System.Workflow.Runtime.WorkflowEventArgs> WorkflowPersisted;
member this.WorkflowPersisted : EventHandler<System.Workflow.Runtime.WorkflowEventArgs> 
Public Custom Event WorkflowPersisted As EventHandler(Of WorkflowEventArgs) 
Public Event WorkflowPersisted As EventHandler(Of WorkflowEventArgs) 

Event Type

Examples

The following code example demonstrates how you can use WorkflowRuntime functionality from a workflow host. The code associates the WorkflowPersisted with an event handler, a method named OnWorkflowPersisted.

This code example is part of the Custom Persistence Service Sample.

workflowRuntime.WorkflowPersisted += OnWorkflowPersisted;
AddHandler workflowRuntime.WorkflowPersisted, AddressOf OnWorkflowPersisted

Remarks

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, WorkflowPersisted 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 WorkflowPersisted event occurs because the workflow instance is being unloaded, it is followed by a WorkflowUnloaded event.

For the WorkflowPersisted event, the sender contains the WorkflowRuntime and WorkflowEventArgs contains the WorkflowInstance associated with the event.

For more information about handling events, see Handling and raising events.

Applies to