Share via


WorkflowInstance.Load Metodo

Definizione

Carica un'istanza del flusso di lavoro precedentemente scaricata.

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

Eccezioni

Il motore di runtime del flusso di lavoro non è in esecuzione.

Esempio

Nell'esempio di codice riportato di seguito viene illustrato come caricare un oggetto WorkflowInstance precedentemente scaricato.

// 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()

Commenti

Load è sincrono; se l'istanza del flusso di lavoro può essere caricata, Load verrà restituito dopo che l'istanza del flusso di lavoro è stata caricata in memoria e pianificata dal motore di runtime del flusso di lavoro. Il runtime genera l'evento WorkflowLoaded dopo che il servizio di persistenza ha ripristinato l'istanza del flusso di lavoro in memoria, ma prima che il motore di runtime del flusso di lavoro pianifichi l'istanza.

Si applica a