[MessageProperty] Attribute in WCF

This attribute specifies those members who will not be serialized into the SOAP message, but contains data that is included with a custom message:

[MessageContract]
public class BookOrder
{
[MessageHeader]
public string ISBN
[MessageProperty]
public string FirstName
{
get { return firstname; }
set { firstname = value; }
}

This attribute allows you to attach data to a custom message and pass it through the WCF system without it being serialized.

Name

Like all the other Name properties, this Name property lets you give a name to the MessageProperty:

[MessageContract]
public class BookOrder
{
[MessageHeader]
public string ISBN
[MessageProperty(Name=”BuyerFirstName”]
public string FirstName
{
get { return firstname; }
set { firstname = value; }
}
Tagged . Bookmark the permalink.

Leave a Reply