Bagikan melalui


WorkflowQueuingService.CreateWorkflowQueue(IComparable, Boolean) Metode

Definisi

WorkflowQueue Membuat dengan menggunakan nama dan cakupan transaksi yang ditentukan.

public:
 System::Workflow::Runtime::WorkflowQueue ^ CreateWorkflowQueue(IComparable ^ queueName, bool transactional);
public System.Workflow.Runtime.WorkflowQueue CreateWorkflowQueue (IComparable queueName, bool transactional);
member this.CreateWorkflowQueue : IComparable * bool -> System.Workflow.Runtime.WorkflowQueue
Public Function CreateWorkflowQueue (queueName As IComparable, transactional As Boolean) As WorkflowQueue

Parameter

queueName
IComparable

Nama antrean.

transactional
Boolean

Nilai yang menentukan apakah WorkflowQueue terlihat di luar cakupan transaksi saat ini.

Mengembalikan

Objek WorkflowQueue.

Pengecualian

queueName adalah referensi null (Nothing dalam Visual Basic).

A WorkflowQueue dengan nama yang ditentukan oleh queueName sudah ada.

Contoh

Contoh kode berikut menunjukkan metode, bernama CreateQueue, yang menginisialisasi WorkflowQueuingService objek dengan memanggil ActivityExecutionContext.GetService metode . Kode kemudian menggunakan Exists metode untuk menentukan apakah ada WorkflowQueue dengan nama tertentu. Jika tidak ada, kode akan memanggil CreateWorkflowQueue metode ; jika kode memanggil GetWorkflowQueue metode .

Contoh kode ini adalah bagian dari Sampel SDK Aktivitas Pengamat File dari file FileSystemEvent.cs. Untuk informasi selengkapnya, lihat Aktivitas Pengamat Sistem File.

private WorkflowQueue CreateQueue(ActivityExecutionContext context)
{
    Console.WriteLine("CreateQueue");
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();

    if (!qService.Exists(this.QueueName))
    {
        qService.CreateWorkflowQueue(this.QueueName, true);
    }

    return qService.GetWorkflowQueue(this.QueueName);
}
Private Function CreateQueue(ByVal context As ActivityExecutionContext) As WorkflowQueue
    Console.WriteLine("CreateQueue")
    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()

    If Not qService.Exists(Me.queueName) Then
        qService.CreateWorkflowQueue(Me.queueName, True)
    End If

    Return qService.GetWorkflowQueue(Me.QueueName)
End Function

Keterangan

WorkflowQueue dibuat dengan yang ditentukan queueName. Jika transaksi adalah true, WorkflowQueue hanya terlihat di dalam transaksi saat ini.

Berlaku untuk

Lihat juga