Share via


WorkflowQueuingService.Exists(IComparable) Metoda

Definice

Testuje existenci zadaného WorkflowQueueobjektu .

public:
 bool Exists(IComparable ^ queueName);
public bool Exists (IComparable queueName);
member this.Exists : IComparable -> bool
Public Function Exists (queueName As IComparable) As Boolean

Parametry

queueName
IComparable

Název procesu WorkflowQueue.

Návraty

true pokud existuje WorkflowQueue , jinak hodnota false.

Výjimky

queueName je odkaz s hodnotou null (Nothing v jazyce Visual Basic).

Příklady

Následující příklad kódu ukazuje metodu s názvem CreateQueue, která inicializuje WorkflowQueuingService objekt voláním ActivityExecutionContext.GetService metody . Kód pak pomocí Exists metody určí, jestli WorkflowQueue existuje se zadaným názvem. Pokud neexistuje, kód volá metodu CreateWorkflowQueue ; pokud ano, kód volá metodu GetWorkflowQueue .

Tento příklad kódu je součástí ukázky sady SDK aktivity služby File Watcher ze souboru FileSystemEvent.cs. Další informace najdete v tématu Aktivita sledovacího procesu systému souborů.

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

Platí pro

Viz také