WorkflowQueuingService.GetWorkflowQueue(IComparable) Metodo

Definizione

Recupera l'oggetto WorkflowQueue specificato.

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

Parametri

queueName
IComparable

Nome dell'oggetto WorkflowQueue da recuperare.

Restituisce

Un oggetto WorkflowQueue.

Eccezioni

queueName è un riferimento null (Nothing in Visual Basic).

L'oggetto WorkflowQueue specificato non è stato trovato.

Esempio

Nell'esempio di codice seguente viene illustrato un metodo, denominato CreateQueue, che inizializza un oggetto WorkflowQueuingService chiamando il metodo ActivityExecutionContext.GetService. Il codice quindi utilizza il metodo Exists per determinare se esiste una classe WorkflowQueue con un nome specificato. Se non esiste, il codice chiama il metodo CreateWorkflowQueue, altrimenti chiama il metodo GetWorkflowQueue.

Questo esempio di codice fa parte dell'esempio SDK File Watcher Activity nel file FileSystemEvent.cs. Per altre informazioni, vedere Attività Watcher di File System.

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

Si applica a

Vedi anche