편집

다음을 통해 공유


DeliveryRequirementsAttribute.QueuedDeliveryRequirements Property

Definition

Specifies whether the binding for a service must support queued contracts.

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

Property Value

One of the QueuedDeliveryRequirementsMode values; the default is Allowed.

Exceptions

The value is not one of the QueuedDeliveryRequirementsMode values.

Examples

The following code example uses the DeliveryRequirementsAttribute attribute to instruct WCF to confirm at runtime that the actual binding does not support queued contracts but does support ordered messages.

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

Remarks

The Required instructs WCF to confirm that the binding supports queued delivery. The NotAllowed value instructs WCF to confirm that the binding does not support queued delivery.

Applies to