Bagikan melalui


WorkflowInstance.Load Metode

Definisi

Memuat instans alur kerja yang sebelumnya tidak dimuat.

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

Pengecualian

Mesin runtime alur kerja tidak berjalan.

Contoh

Contoh berikut menunjukkan cara memuat objek yang sebelumnya tidak dimuat WorkflowInstance .

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

Keterangan

Load sinkron; jika instans alur kerja dapat dimuat, Load akan kembali setelah instans alur kerja dimuat ke dalam memori dan dijadwalkan oleh mesin runtime alur kerja. Runtime meningkatkan peristiwa setelah layanan persistensi memulihkan instans WorkflowLoaded alur kerja dalam memori, tetapi sebelum mesin runtime alur kerja menjadwalkan instans.

Berlaku untuk