This topic has not yet been rated - Rate this topic

WorkflowInstance.Load Method

Loads a previously unloaded workflow instance.

Namespace:  System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)
public void Load()
Exception Condition
InvalidOperationException

The workflow runtime engine is not running.

Load is synchronous; if the workflow instance can be loaded, Load will return after the workflow instance has been loaded into memory and scheduled by the workflow runtime engine. The runtime raises the WorkflowLoaded event after the persistence service has restored the workflow instance in memory, but before the workflow runtime engine schedules the instance.

The following example demonstrates how to load a previously unloaded WorkflowInstance object.


// Create a WorkflowRuntime object
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Create a new instance of the out-of-box SqlWorkflowPersistenceService
SqlWorkflowPersistenceService persistenceService =
   new SqlWorkflowPersistenceService(
   "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;");
// Add the service to the runtime
workflowRuntime.AddService(persistenceService);
// Create a WorkflowInstance object
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(typeof(Workflow1));
// Start the workflow instance
workflowInstance.Start();
//Unload the instance
workflowInstance.Unload();
//Reload the previously unloaded instance
workflowInstance.Load();


.NET Framework

Supported in: 4, 3.5, 3.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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)
Community Content Add
Annotations FAQ