WCF: "IsRequired" property for DataMember with "IsReference" property for DataContract
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?
开发者_JS百科 [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
精彩评论