Unloads the workflow instance from memory to the persistence store when the instance is suspended or idle.
Assembly: System.Workflow.Runtime (in System.Workflow.Runtime.dll)
There is no persistence service registered with the workflow runtime engine.
If the workflow instance is idle or suspended, 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, 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 to reclaim system resources from an idle workflow.
The following example demonstrates using the TryUnload method to unload a workflow when the WorkflowIdled event fires. This example is from the Using Persistence Services SDK sample, from the Program.cs file. For more information, see Using Persistence Services Sample.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.