1.

What Is Data Contract Equivalence?

Answer»

Two DATA contracts are said to be equivalent, if they satisfy the following conditions.

  • Both the datacontracts MUST have same namespace
  • Both the datacontracts must have same name
  • The data member on data contract must have an equivalent data member on the other.
  • The members in the datacontract must APPEAR in the same order in both datacontracts.

Ex:

The following two data contracts are equal.

[DataContract]
public class PERSON
{
[DataMember]
public string Name;
[DataMember]
public string Email_ID;
}
[DataContract(Name = "Person")]
public class Employee
{
[DataMember(Name = "Name")]
private string EmpName;
private string ADDRESS;
[DataMember(Name = "Email_ID")]
private string EmpEmailId;
}

Two data contracts are said to be equivalent, if they satisfy the following conditions.

Ex:

The following two data contracts are equal.

[DataContract]
public class Person
{
[DataMember]
public string Name;
[DataMember]
public string Email_ID;
}
[DataContract(Name = "Person")]
public class Employee
{
[DataMember(Name = "Name")]
private string EmpName;
private string address;
[DataMember(Name = "Email_ID")]
private string EmpEmailId;
}



Discussion

No Comment Found