SoapExtensionAttribute Klasa

Definicja

W przypadku zastąpienia w klasie pochodnej określa, że rozszerzenie PROTOKOŁU SOAP powinno być uruchamiane przy użyciu metody usługi sieci Web XML.

public ref class SoapExtensionAttribute abstract : Attribute
public abstract class SoapExtensionAttribute : Attribute
type SoapExtensionAttribute = class
    inherit Attribute
Public MustInherit Class SoapExtensionAttribute
Inherits Attribute
Dziedziczenie
SoapExtensionAttribute

Przykłady

Poniższa TraceExtensionAttribute klasa pochodzi z SoapExtensionAttribute , aby obsługiwać stosowanie atrybutu do metody usługi sieci Web XML lub metody w klasie serwera proxy klienta usługi sieci Web XML. Po zastosowaniu TraceExtension do dowolnego z nich rozszerzenie SOAP jest uruchamiane przy użyciu metody .

// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.

[AttributeUsage(AttributeTargets::Method)]
public ref class TraceExtensionAttribute: public SoapExtensionAttribute
{
private:
   String^ myFilename;
   int myPriority;

public:

   // Set the name of the log file were SOAP messages will be stored.
   TraceExtensionAttribute()
      : SoapExtensionAttribute()
   {
      myFilename = "C:\\logClient.txt";
   }

   property Type^ ExtensionType 
   {
      // Return the type of 'TraceExtension' class.
      virtual Type^ get() override
      {
         return TraceExtension::typeid;
      }
   }

   property int Priority 
   {
      // User can set priority of the 'SoapExtension'.
      virtual int get() override
      {
         return myPriority;
      }

      virtual void set( int value ) override
      {
         myPriority = value;
      }
   }

   property String^ Filename 
   {
      String^ get()
      {
         return myFilename;
      }

      void set( String^ value )
      {
         myFilename = value;
      }
   }
};
// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.
[AttributeUsage(AttributeTargets.Method)]
public class TraceExtensionAttribute : SoapExtensionAttribute {

    private string myFilename;
    private int myPriority;

    // Set the name of the log file were SOAP messages will be stored.
    public TraceExtensionAttribute() : base()
    {
        myFilename = "C:\\logClient.txt";
    }

    // Return the type of 'TraceExtension' class.
    public override Type ExtensionType
    {
        get
        {
            return typeof(TraceExtension);
        }
    }

    // User can set priority of the 'SoapExtension'.
    public override int Priority
    {
        get
        {
            return myPriority;
        }
        set
        {
            myPriority = value;
        }
    }

    public string Filename
    {
        get
        {
            return myFilename;
        }
        set
        {
            myFilename = value;
        }
    }
}
' Create a SoapExtensionAttribute for a SOAP extension that can be
' applied to an XML Web service method.
<AttributeUsage(AttributeTargets.Method)> _
Public Class TraceExtensionAttribute
    Inherits SoapExtensionAttribute
    
    Private m_filename As String = "c:\log.txt"
    Private m_priority As Integer

   ' Return the type of 'TraceExtension' class.
    Public Overrides ReadOnly Property ExtensionType() As Type
        Get
            Return GetType(TraceExtension)
        End Get
    End Property

   ' User can set priority of the 'TraceExtension'.
    Public Overrides Property Priority() As Integer
        Get
            Return m_priority
        End Get
        Set(ByVal Value As Integer)
            m_priority = value
        End Set
    End Property

    Public Property Filename() As String
        Get
            Return m_filename
        End Get
        Set(ByVal Value As String)
            m_filename = value
        End Set
    End Property
End Class

Uwagi

Metody usługi sieci Web XML utworzone przy użyciu ASP.NET można skonfigurować do uruchamiania z rozszerzeniem SOAP, stosując atrybut do metody usługi sieci Web XML. Gdy atrybut rozszerzenia niestandardowego zostanie dodany do metody usługi sieci Web XML lub metody w klasie serwera proxy klienta, ASP.NET wywołuje skojarzone rozszerzenie w odpowiednim czasie. Atrybut rozszerzenia to niestandardowa klasa atrybutów pochodząca z SoapExtensionAttributeklasy . Atrybuty pochodne muszą zastąpić właściwość, ExtensionType aby zwrócić typ rozszerzenia skojarzonego z atrybutem.

Konstruktory

SoapExtensionAttribute()

Inicjuje nowe wystąpienie klasy SoapExtensionAttribute.

Właściwości

ExtensionType

Po przesłonięciu w klasie pochodnej pobiera Type rozszerzenie SOAP.

Priority

Po zastąpieniu w klasie pochodnej pobiera lub ustawia priorytet rozszerzenia SOAP.

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego elementu Attribute.

(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 bieżące wystąpienie.

(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)

W przypadku zastąpienia 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 obiektu, którego można użyć do pobrania informacji o typie 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)

Dotyczy

Zobacz też