Compartilhar via


DeliveryRequirementsAttribute.RequireOrderedDelivery Propriedade

Definição

Especifica se a associação deve dar suporte a mensagens ordenadas.

public:
 property bool RequireOrderedDelivery { bool get(); void set(bool value); };
public bool RequireOrderedDelivery { get; set; }
member this.RequireOrderedDelivery : bool with get, set
Public Property RequireOrderedDelivery As Boolean

Valor da propriedade

true instrui o WCF (Windows Communication Foundation) a confirmar que a associação deve dar suporte à ordenação de mensagens; caso contrário, false. O padrão é false.

Exemplos

O exemplo de código a seguir usa o atributo para instruir o DeliveryRequirementsAttribute WCF a confirmar em runtime que a associação real dá suporte a mensagens ordenadas.

using System;
using System.ServiceModel;

[ServiceContract]
interface ICalculatorService
{
  [OperationBehavior()]
  int Add(int a, int b);

  [OperationContract]
  int Subtract(int a, int b);
}

[DeliveryRequirementsAttribute(
  QueuedDeliveryRequirements=QueuedDeliveryRequirementsMode.NotAllowed,
  RequireOrderedDelivery=true
)]
class CalculatorService: ICalculatorService
{
  public int Add(int a, int b)
  {
    Console.WriteLine("Add called.");
    return a + b;
  }

  public int Subtract(int a, int b)
  {
    Console.WriteLine("Subtract called.");
    return a - b;
  }

  public int Multiply(int a, int b)
  {
    return a * b;
  }
}
Imports System.ServiceModel

<ServiceContract()> _
Public Interface ICalculatorService

    <OperationBehavior()> _
    Function Add(ByVal a As Integer, ByVal b As Integer) As Integer

    <OperationContract()> _
    Function Subtract(ByVal a As Integer, ByVal b As Integer) As Integer
End Interface

<DeliveryRequirements( _
    QueuedDeliveryRequirements:=QueuedDeliveryRequirementsMode.NotAllowed, _
    RequireOrderedDelivery:=True _
)> _
Class CalculatorService
    Public Function add(ByVal a As Integer, ByVal b As Integer) As Integer
        Console.WriteLine("Add called")
        Return a + b
    End Function

    Public Function Subtract(ByVal a As Integer, ByVal b As Integer) As Integer
        Console.WriteLine("Subtract called.")
        Return a - b
    End Function

    Public Function Multiply(ByVal a As Integer, ByVal b As Integer) As Integer
        Return a * b
    End Function
End Class

Comentários

Definir a propriedade como false instrui o RequireOrderedDelivery WCF a não executar nenhuma validação.

Aplica-se a