开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜