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

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
// Create a WorkflowInstance object
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(typeof(Workflow1));
// Start the workflow instance
//Unload the instance
//Reload the previously unloaded instance

.NET Framework
Available since 3.0
Return to top