DeliveryRequirementsAttribute Klasa

Definicja

Określa wymagania dotyczące funkcji, które powiązania muszą zapewniać implementację usługi lub 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
Dziedziczenie
DeliveryRequirementsAttribute
Atrybuty
Implementuje

Przykłady

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

Uwagi

Użyj polecenia DeliveryRequirementsAttribute , aby Windows Communication Foundation (WCF), aby potwierdzić, że powiązanie zapewnia funkcje wymagane przez usługę lub implementację klienta. DeliveryRequirementsAttribute Jeśli atrybut zostanie wykryty, gdy opis usługi zostanie załadowany z pliku konfiguracji aplikacji lub skompilowany programowo w kodzie, program WCF weryfikuje skonfigurowane powiązanie i obsługuje wszystkie funkcje określone przez atrybut. Na przykład usługa może wymagać powiązań do obsługi kolejkowania. Użycie DeliveryRequirementsAttribute polecenia umożliwia usłudze WCF potwierdzenie spełnienia następujących wymagań:

Atrybut DeliveryRequirementsAttribute jest stosowany do klasy, która może implementować dowolną liczbę interfejsów kontraktu usługi. DeliveryRequirementsAttribute można zastosować do wszystkich kontraktów implementowane przez klasę lub tylko do jednego z nich. Atrybut można zastosować do klasy więcej niż raz.

Konstruktory

DeliveryRequirementsAttribute()

Inicjuje nowe wystąpienie klasy DeliveryRequirementsAttribute.

Właściwości

QueuedDeliveryRequirements

Określa, czy powiązanie usługi musi obsługiwać kontrakty w kolejce.

RequireOrderedDelivery

Określa, czy powiązanie musi obsługiwać uporządkowane komunikaty.

TargetContract

Pobiera lub ustawia typ, do którego ma zastosowanie.

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego Attributeelementu .

(Odziedziczone po Attribute)

Metody

Equals(Object)

Zwraca wartość wskazującą, czy to wystąpienie jest równe podanemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
IsDefaultAttribute()

W przypadku zastąpienia w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)

Po przesłonięciu w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Pobiera informacje o typie dla obiektu, który może służyć do pobierania informacji o typie dla interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)
IContractBehavior.AddBindingParameters(ContractDescription, ServiceEndpoint, BindingParameterCollection)

Implementuje metodę w celu poprawnego IContractBehavior.AddBindingParameters(ContractDescription, ServiceEndpoint, BindingParameterCollection) dołączania parametrów powiązania.

IContractBehavior.ApplyClientBehavior(ContractDescription, ServiceEndpoint, ClientRuntime)

Implementacja IContractBehavior.ApplyClientBehavior(ContractDescription, ServiceEndpoint, ClientRuntime) metody obsługi klienta.

IContractBehavior.ApplyDispatchBehavior(ContractDescription, ServiceEndpoint, DispatchRuntime)

Implementacja ApplyDispatchBehavior(ContractDescription, ServiceEndpoint, DispatchRuntime) metody, która umożliwia obsługę usługi.

IContractBehavior.Validate(ContractDescription, ServiceEndpoint)

Implementuje metodę w celu włączenia IContractBehavior.Validate(ContractDescription, ServiceEndpoint) obsługi walidacji.

Dotyczy