Compartilhar via


WorkflowQueuingService.CreateWorkflowQueue(IComparable, Boolean) Método

Definição

Cria uma WorkflowQueue usando o nome especificado e o escopo transacional.

public:
 System::Workflow::Runtime::WorkflowQueue ^ CreateWorkflowQueue(IComparable ^ queueName, bool transactional);
public System.Workflow.Runtime.WorkflowQueue CreateWorkflowQueue (IComparable queueName, bool transactional);
member this.CreateWorkflowQueue : IComparable * bool -> System.Workflow.Runtime.WorkflowQueue
Public Function CreateWorkflowQueue (queueName As IComparable, transactional As Boolean) As WorkflowQueue

Parâmetros

queueName
IComparable

O nome da fila.

transactional
Boolean

Um valor que especifica se a WorkflowQueue está visível fora do escopo da transação atual.

Retornos

Um objeto WorkflowQueue.

Exceções

queueName é uma referência nula (Nothing no Visual Basic).

Já existe uma WorkflowQueue com o nome especificado por queueName.

Exemplos

O exemplo de código a seguir demonstra um método, chamado CreateQueue, que inicializa um WorkflowQueuingService objeto chamando o ActivityExecutionContext.GetService método . Em seguida, o código usa o Exists método para determinar se existe um WorkflowQueue com um nome especificado. Se ele não existir, o código chamará o CreateWorkflowQueue método; se ele fizer isso, o código chamará o GetWorkflowQueue método .

Este exemplo de código faz parte do Exemplo de SDK de Atividade do Observador de Arquivos do arquivo FileSystemEvent.cs. Para obter mais informações, consulte Atividade do Observador do Sistema de Arquivos.

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

Comentários

Um WorkflowQueue é criado com o especificado queueName. Se transacional for true, o WorkflowQueue só ficará visível dentro da transação atual.

Aplica-se a

Confira também