Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

WorkflowApplication::Persist Method

Persists a workflow instance to an instance store.

Namespace:  System.Activities
Assembly:  System.Activities (in System.Activities.dll)
void Persist()

If the persist operation does not complete within 30 seconds, a TimeoutException is thrown.

If the workflow instance was previously loaded from persistence, then the same InstanceStore used to load the workflow is used for persistence. If the workflow was created and has not yet been persisted, then an InstanceStore must be configured before calling this method or else an InvalidOperationException is thrown when this method is called.

The following example calls Persist to persist a workflow instance before the workflow is started. This example is part of the StartAndUnloadInstance method in the Persisting a Workflow Instance sample.

WorkflowApplication application = new WorkflowApplication(activity);

application.InstanceStore = instanceStore;

//returning IdleAction.Unload instructs the WorkflowApplication to persists application state and remove it from memory  
application.PersistableIdle = (e) =>
    return PersistableIdleAction.Unload;

application.Unloaded = (e) =>

//This call is not required  
//Calling persist here captures the application durably before it has been started
id = application.Id;


.NET Framework

Supported in: 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows Phone 8.1, Windows Phone 8, 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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.