WorkflowQueuingService.Exists(IComparable) Метод

Определение

Выполняет проверку существования указанной очереди WorkflowQueue.

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

Параметры

queueName
IComparable

Имя WorkflowQueue.

Возвращаемое значение

Значение true, если очередь WorkflowQueue существует; в противном случае — значение false.

Исключения

Параметр queueName является неопределенной ссылкой (Nothing в Visual Basic).

Примеры

В следующем примере кода показан метод с именем CreateQueue, инициализирующий службу WorkflowQueuingService, вызывая метод ActivityExecutionContext.GetService. Затем код использует метод Exists, чтобы определить, существует ли очередь WorkflowQueue с указанным именем. Если она не существует, то код вызывает метод CreateWorkflowQueue; в противном случае код вызывает метод GetWorkflowQueue.

Этот пример кода является частью образца File Watcher Activity из пакета SDK (файл FileSystemEvent.cs). Дополнительные сведения см. в разделе Действия наблюдателя файловой системы.

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

Применяется к

См. также раздел