Share via


WorkflowInstance.Load Método

Definição

Carrega uma instância de fluxo de trabalho descarregada anteriormente.

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

Exceções

O mecanismo de runtime de fluxo de trabalho não está em execução.

Exemplos

O exemplo a seguir demonstra como carregar um objeto descarregado WorkflowInstance anteriormente.

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

Comentários

Load é síncrono; se a instância de fluxo de trabalho puder ser carregada, Load retornará depois que a instância de fluxo de trabalho tiver sido carregada na memória e agendada pelo mecanismo de runtime de fluxo de trabalho. O runtime gera o WorkflowLoaded evento depois que o serviço de persistência restaura a instância de fluxo de trabalho na memória, mas antes que o mecanismo de runtime de fluxo de trabalho agende a instância.

Aplica-se a