Data Contract:
Data Contract are contractual agreement about the format and structure of the payload data(that is, the SOAP body) in the messages exchanged between a service and its consumer.
Data contracts are the preferred WCF way to enable serialization of complex types included in operating signatures, either as pa rameters or as return types.
Data contracts are declared by applying the Data ContractAttribute to a .N ET types and it will need to decorate that type's member that you want to include in the Data contract with the Data Member attribute.
The following code shows a few Data contract definitions; first, an enumeration and then a class.
[DataContract( Namespace = "http://schemas.fabrikam.com/customers/")]
public enum TitleOptions: int
{
[Enumember()]
Mr = 0.
[Enumember()]
Ms = 1.
[Enumember()]
Mrs = 2.
[Enumember()]
Dr = 3,
}
[DataContract( Namespace = "http://schemas.fabrikam.com/customers/")]
public class Contactinfo
{
[DataMember(IsRequired = false)]
public string Phone Number;
[DataMember(IsRequired = false)]
public string Email;
}
No comments :
Post a Comment