DeliveryRequirementsAttribute.QueuedDeliveryRequirements 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定服务的绑定是否必须支持排队协定。
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
属性值
QueuedDeliveryRequirementsMode 值之一,默认值为 Allowed。
例外
示例
下面的代码示例使用 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
注解
指示 Required WCF 确认绑定支持排队传递。 该值 NotAllowed 指示 WCF 确认绑定不支持排队传递。