WorkflowInstance.Load Method
Loads a previously unloaded workflow instance.
Assembly: System.Workflow.Runtime (in System.Workflow.Runtime.dll)
| 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();
- 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 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.