WorkflowQueuingService.GetWorkflowQueue(IComparable) Метод

Определение

Получает указанный объект WorkflowQueue.

public:
 System::Workflow::Runtime::WorkflowQueue ^ GetWorkflowQueue(IComparable ^ queueName);
public System.Workflow.Runtime.WorkflowQueue GetWorkflowQueue (IComparable queueName);
member this.GetWorkflowQueue : IComparable -> System.Workflow.Runtime.WorkflowQueue
Public Function GetWorkflowQueue (queueName As IComparable) As WorkflowQueue

Параметры

queueName
IComparable

Имя извлекаемого объекта WorkflowQueue.

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

Объект WorkflowQueue.

Исключения

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

Указанный объект WorkflowQueue не найден.

Примеры

В следующем примере кода показан метод с именем 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

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

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