WorkflowQueuingService.Exists(IComparable) Método

Definición

Prueba la existencia de la WorkflowQueue especificada.

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

Parámetros

queueName
IComparable

Nombre del objeto WorkflowQueue.

Devoluciones

Es true si existe el evento WorkflowQueue; de lo contrario, es false.

Excepciones

queueName es una referencia nula (Nothing en Visual Basic).

Ejemplos

El ejemplo de código siguiente muestra un método, denominado CreateQueue, que inicializa un objeto WorkflowQueuingService llamando al método ActivityExecutionContext.GetService. A continuación, el código utiliza el método Exists para determinar si existe un WorkflowQueue con un nombre específico. Si no existe, el código llama al método CreateWorkflowQueue; si sí que existe, el código llama al método GetWorkflowQueue.

Este ejemplo de código forma parte de la muestra de SDK de actividad de observador de archivo del archivo FileSystemEvent.cs. Para obtener más información, vea Actividad del monitor del sistema de archivos.

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

Se aplica a

Consulte también