Compartir vía


WorkflowInstance.Load Método

Definición

Carga una instancia de flujo de trabajo previamente descargada.

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

Excepciones

El motor en tiempo de ejecución de flujo de trabajo no está en ejecución.

Ejemplos

El ejemplo siguiente muestra cómo cargar un objeto WorkflowInstance previamente descargado.

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

Comentarios

Load es sincrónico; si se puede cargar la instancia de flujo de trabajo, Load devolverá cuando el motor en tiempo de ejecución de flujo de trabajo haya cargado en la memoria y haya programado la instancia de flujo de trabajo. El tiempo de ejecución genera el evento WorkflowLoaded después de que el servicio de persistencia haya restaurado la instancia de flujo de trabajo en memoria, pero antes de que el motor en tiempo de ejecución de flujo de trabajo programe la instancia.

Se aplica a