WCF Data Services Question:

Explain Data contracts?

Tweet Share WhatsApp

Answer:

Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but we can easily define explicit opt-in data contracts for custom types.

There are two types of Data Contracts.
DataContract - attribute used to define the class
DataMember - attribute used to define the properties.

[DataContract]
class Contact
{
[DataMember]
public string FirstName;

[DataMember]
public string LastName;
}

Download WCF Data Services PDF Read All 26 WCF Data Services Questions
Previous QuestionNext Question
Explain Service contracts?Can you explain fault contracts?