DeliveryRequirementsAttribute Třída
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Určuje požadavky na funkce, které vazby musí poskytovat pro implementaci služby nebo klienta.
public ref class DeliveryRequirementsAttribute sealed : Attribute, System::ServiceModel::Description::IContractBehavior
public ref class DeliveryRequirementsAttribute sealed : Attribute, System::ServiceModel::Description::IContractBehavior, System::ServiceModel::Description::IContractBehaviorAttribute
public sealed class DeliveryRequirementsAttribute : Attribute, System.ServiceModel.Description.IContractBehavior
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true)]
public sealed class DeliveryRequirementsAttribute : Attribute, System.ServiceModel.Description.IContractBehavior, System.ServiceModel.Description.IContractBehaviorAttribute
type DeliveryRequirementsAttribute = class
inherit Attribute
interface IContractBehavior
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true)>]
type DeliveryRequirementsAttribute = class
inherit Attribute
interface IContractBehavior
interface IContractBehaviorAttribute
Public NotInheritable Class DeliveryRequirementsAttribute
Inherits Attribute
Implements IContractBehavior
Public NotInheritable Class DeliveryRequirementsAttribute
Inherits Attribute
Implements IContractBehavior, IContractBehaviorAttribute
- Dědičnost
- Atributy
- Implementuje
Příklady
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
Poznámky
Pomocí příkazu DeliveryRequirementsAttribute Windows Communication Foundation (WCF) potvrďte, že vazba poskytuje funkce vyžadované službou nebo implementací klienta. DeliveryRequirementsAttribute Pokud je atribut zjištěn, když je popis služby načten z konfiguračního souboru aplikace nebo sestaven programově v kódu, WCF ověří nakonfigurovanou vazbu a podporuje všechny funkce, které atribut určuje. Vaše služba může například vyžadovat vazby pro podporu řízení front. Použití DeliveryRequirementsAttribute technologie WCF umožňuje potvrdit splnění následujících požadavků:
Vlastnost QueuedDeliveryRequirements určuje požadavky na řazení front, které musí vazba splňovat.
Vlastnost RequireOrderedDelivery označuje, zda vazba musí podporovat seřazené zasílání zpráv.
Vlastnost TargetContract označuje, pro který typ se vztahují požadavky.
Atribut DeliveryRequirementsAttribute se použije na třídu, která může implementovat libovolný počet rozhraní kontraktů služeb. DeliveryRequirementsAttribute lze použít pro všechny kontrakty, které třída implementuje, nebo pouze na jeden z nich. Atribut lze použít na třídu více než jednou.
Konstruktory
| Name | Description |
|---|---|
| DeliveryRequirementsAttribute() |
Inicializuje novou instanci DeliveryRequirementsAttribute třídy. |
Vlastnosti
| Name | Description |
|---|---|
| QueuedDeliveryRequirements |
Určuje, jestli vazba pro službu musí podporovat kontrakty zařazené do fronty. |
| RequireOrderedDelivery |
Určuje, jestli vazba musí podporovat seřazené zprávy. |
| TargetContract |
Získá nebo nastaví typ, na který se vztahuje. |
| TypeId |
Při implementaci v odvozené třídě získá jedinečný identifikátor pro tento Attribute. (Zděděno od Attribute) |
Metody
| Name | Description |
|---|---|
| Equals(Object) |
Vrátí hodnotu, která určuje, zda je tato instance rovna zadanému objektu. (Zděděno od Attribute) |
| GetHashCode() |
Vrátí kód hash pro tuto instanci. (Zděděno od Attribute) |
| GetType() |
Získá Type aktuální instance. (Zděděno od Object) |
| IsDefaultAttribute() |
Při přepsání v odvozené třídě určuje, zda hodnota této instance je výchozí hodnotou pro odvozenou třídu. (Zděděno od Attribute) |
| Match(Object) |
Při přepsání v odvozené třídě vrátí hodnotu, která určuje, zda se tato instance rovná zadanému objektu. (Zděděno od Attribute) |
| MemberwiseClone() |
Vytvoří mělkou kopii aktuálního Object. (Zděděno od Object) |
| ToString() |
Vrátí řetězec, který představuje aktuální objekt. (Zděděno od Object) |