DeliveryRequirementsAttribute.QueuedDeliveryRequirements Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
One of the QueuedDeliveryRequirementsMode values; the default is Allowed.
The value is not one of the QueuedDeliveryRequirementsMode values.
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
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.
Produkt | Versions |
---|---|
.NET | 8 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET er et åben kildekode projekt. Vælg et link for at give feedback: