MessagePropertyAttribute Klasa

Definicja

Reprezentuje dane przekazywane lokalnie z niestandardowym typem komunikatu, ale nie serializowane do komunikatu SOAP.

public ref class MessagePropertyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed class MessagePropertyAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, Inherited=false)]
public sealed class MessagePropertyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)>]
type MessagePropertyAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, Inherited=false)>]
type MessagePropertyAttribute = class
    inherit Attribute
Public NotInheritable Class MessagePropertyAttribute
Inherits Attribute
Dziedziczenie
MessagePropertyAttribute
Atrybuty

Przykłady

Poniższy przykład kodu przedstawia użycie atrybutu MessagePropertyAttribute .

[MessageContractAttribute]
public class CustomMessage
{
    private Person internalPerson;
    [MessageProperty]
    private int a = 23;
    [MessageBodyMember(Name="Person")]
    public PersonType Data
    {
        get
        {
            return internalPerson;
        }
        set
        {
            this.internalPerson = (Person)value;
        }
    }
}
<MessageContractAttribute> _
Public Class CustomMessage
    Private internalPerson As Person
    <MessageProperty> _
    Private a As Integer = 23
    <MessageBodyMember(Name:="Person")> _
    Public Property Data() As PersonType
        Get
            Return internalPerson
        End Get
        Set(ByVal value As PersonType)
            Me.internalPerson = CType(value, Person)
        End Set
    End Property
End Class

Uwagi

Użyj atrybutu MessagePropertyAttribute , aby dołączyć dane do niestandardowego typu komunikatu, gdy przechodzi przez system Windows Communication Foundation (WCF) bez serializacji danych do komunikatu SOAP.

Konstruktory

MessagePropertyAttribute()

Inicjuje nowe wystąpienie klasy MessagePropertyAttribute.

Właściwości

Name

Pobiera lub ustawia nazwę właściwości.

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