Fabiano
Fabiano

Reputation: 5194

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?

    [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.

Upvotes: 4

Views: 2463

Answers (1)

Tony The Lion
Tony The Lion

Reputation: 63250

There is an explanation for the behaviour you're getting here

I'm not sure about way's to solve this issue

Upvotes: 1

Related Questions