Bagikan melalui


WorkflowApplication.Persist Metode

Definisi

Mempertahankan instans alur kerja ke penyimpanan instans.

Overload

Persist()

Mempertahankan instans alur kerja ke penyimpanan instans.

Persist(TimeSpan)

Mempertahankan instans alur kerja ke penyimpanan instans menggunakan interval waktu habis yang ditentukan.

Keterangan

Jika instans alur kerja sebelumnya dimuat dari persistensi, maka hal yang sama digunakan InstanceStore untuk memuat alur kerja digunakan untuk persistensi. Jika alur kerja dibuat dan belum dipertahankan, maka InstanceStore harus dikonfigurasi sebelum memanggil metode ini atau dilemparkan InvalidOperationException ketika metode ini dipanggil.

Persist()

Mempertahankan instans alur kerja ke penyimpanan instans.

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

Contoh

Contoh berikut memanggil untuk mempertahankan instans Persist alur kerja sebelum alur kerja dimulai.

WorkflowApplication application = new WorkflowApplication(activity);

application.InstanceStore = instanceStore;

//returning IdleAction.Unload instructs the WorkflowApplication to persists application state and remove it from memory
application.PersistableIdle = (e) =>
{
    return PersistableIdleAction.Unload;
};

application.Unloaded = (e) =>
{
    instanceUnloaded.Set();
};

//This call is not required
//Calling persist here captures the application durably before it has been started
application.Persist();
id = application.Id;
application.Run();

instanceUnloaded.WaitOne();

Keterangan

Jika operasi persisten tidak selesai dalam waktu 30 detik, akan TimeoutException dilemparkan.

Jika instans alur kerja sebelumnya dimuat dari persistensi, maka hal yang sama digunakan InstanceStore untuk memuat alur kerja digunakan untuk persistensi. Jika alur kerja dibuat dan belum dipertahankan, maka InstanceStore harus dikonfigurasi sebelum memanggil metode ini atau dilemparkan InvalidOperationException ketika metode ini dipanggil.

Berlaku untuk

Persist(TimeSpan)

Mempertahankan instans alur kerja ke penyimpanan instans menggunakan interval waktu habis yang ditentukan.

public:
 void Persist(TimeSpan timeout);
public void Persist (TimeSpan timeout);
member this.Persist : TimeSpan -> unit
Public Sub Persist (timeout As TimeSpan)

Parameter

timeout
TimeSpan

Interval di mana operasi persisten harus diselesaikan sebelum operasi dibatalkan dan TimeoutException dilemparkan.

Contoh

Contoh berikut memanggil untuk mempertahankan instans Persist alur kerja sebelum alur kerja dimulai.

WorkflowApplication application = new WorkflowApplication(activity);

application.InstanceStore = instanceStore;

//returning IdleAction.Unload instructs the WorkflowApplication to persists application state and remove it from memory
application.PersistableIdle = (e) =>
{
    return PersistableIdleAction.Unload;
};

application.Unloaded = (e) =>
{
    instanceUnloaded.Set();
};

//This call is not required
//Calling persist here captures the application durably before it has been started
application.Persist();
id = application.Id;
application.Run();

instanceUnloaded.WaitOne();

Keterangan

Jika instans alur kerja sebelumnya dimuat dari persistensi, maka hal yang sama digunakan InstanceStore untuk memuat alur kerja digunakan untuk persistensi. Jika alur kerja dibuat dan belum dipertahankan, maka InstanceStore harus dikonfigurasi sebelum memanggil metode ini atau dilemparkan InvalidOperationException ketika metode ini dipanggil.

Berlaku untuk