Share via


WorkflowInstance.Load Méthode

Définition

Charge une instance de workflow précédemment déchargée.

public:
 void Load();
public void Load ();
member this.Load : unit -> unit
Public Sub Load ()

Exceptions

Le moteur d'exécution de workflow ne s'exécute pas.

Exemples

L'exemple suivant montre comment charger un objet WorkflowInstance précédemment déchargé.

// 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();
' Create a WorkflowRuntime object
Dim workflowRuntime As New WorkflowRuntime()
' Create a new instance of the out-of-box SqlWorkflowPersistenceService
Dim persistenceService As _
   New SqlWorkflowPersistenceService( _
   "Initial Catalog=SqlPersistenceServiceData Source=localhostIntegrated Security=SSPI")
' Add the service to the runtime
workflowRuntime.AddService(persistenceService)
' Create a WorkflowInstance object
Dim workflowInstance As WorkflowInstance = workflowRuntime.CreateWorkflow(GetType(Workflow1))
' Start the workflow instance
workflowInstance.Start()
'Unload the instance
workflowInstance.Unload()
'Reload the previously unloaded instance
workflowInstance.Load()

Remarques

Load est synchrone ; si l'instance de workflow peut être chargée, Load sera renvoyé après le chargement de l'instance de workflow dans la mémoire et sa planification par le moteur d'exécution de workflow. L'exécution déclenche l'événement WorkflowLoaded après que le service de persistance ait restauré l'instance de workflow en mémoire, mais avant que le moteur d'exécution de workflow l'ait planifiée.

S’applique à