Why does WCF does not allow to set the “IsRequired” property for DataMembers when I set the “IsReference” property for the DataMember’s DataContract? And is there a way to solve this problem?
[DataContract(IsReference = true)]
public class MyClass
{
private DateTime date;
[DataMember (IsRequired = true)]
public DateTime Date
{
get { return date; }
set { date = value; }
}
}
This code will create an error because “IsReference” and “IsRequired” are set.
There is an explanation for the behaviour you’re getting here
I’m not sure about way’s to solve this issue