Edit

Share via


WorkflowInstance.TryUnload Method

Definition

Unloads the workflow instance from memory to the persistence store when the instance is suspended or idle.

public:
 bool TryUnload();
public bool TryUnload();
member this.TryUnload : unit -> bool
Public Function TryUnload () As Boolean

Returns

true if the workflow instance was unloaded; otherwise, false.

Exceptions

There is no persistence service registered with the workflow runtime engine.

Remarks

If the workflow instance is idle or suspended, TryUnload uses the persistence service to remove the workflow instance from memory and persist it to a data store. If there is no persistence service registered with the WorkflowRuntime, TryUnload throws an InvalidOperationException. If the workflow instance is successfully persisted, the runtime raises the WorkflowUnloaded event, and returns true. Unload returns false if the workflow instance has already been unloaded, has been terminated, has been aborted, or has already completed.

The host can use TryUnload to reclaim system resources from an idle workflow.

Applies to