Condividi tramite


DeliveryRequirementsAttribute.QueuedDeliveryRequirements Proprietà

Definizione

Specifica se l'associazione di un servizio deve supportare i contratti in coda.

public:
 property System::ServiceModel::QueuedDeliveryRequirementsMode QueuedDeliveryRequirements { System::ServiceModel::QueuedDeliveryRequirementsMode get(); void set(System::ServiceModel::QueuedDeliveryRequirementsMode value); };
public System.ServiceModel.QueuedDeliveryRequirementsMode QueuedDeliveryRequirements { get; set; }
member this.QueuedDeliveryRequirements : System.ServiceModel.QueuedDeliveryRequirementsMode with get, set
Public Property QueuedDeliveryRequirements As QueuedDeliveryRequirementsMode

Valore della proprietà

QueuedDeliveryRequirementsMode

Uno dei valori di QueuedDeliveryRequirementsMode. Il valore predefinito è Allowed.

Eccezioni

Il valore non appartiene all'enumerazione QueuedDeliveryRequirementsMode.

Esempio

L'esempio di codice seguente usa l'attributo per indicare a WCF di confermare in fase di esecuzione che l'associazione DeliveryRequirementsAttribute effettiva non supporta i contratti in coda, ma supporta i messaggi ordinati.

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

Commenti

Required Indica a WCF di confermare che l'associazione supporta il recapito in coda. Il NotAllowed valore indica a WCF di confermare che l'associazione non supporta il recapito in coda.

Si applica a