DeliveryRequirementsAttribute.RequireOrderedDelivery 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定繫結是否必須支援已排序的訊息。
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
屬性值
true
指示 Windows Communication Foundation (WCF) 確認系結必須支援訊息排序;否則為 false
。 預設為 false
。
範例
下列程式碼範例會 DeliveryRequirementsAttribute 使用 屬性指示 WCF 在執行時間確認實際系結確實支援已排序的訊息。
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
備註
RequireOrderedDelivery將 屬性設定為 , false
指示 WCF 執行任何驗證。