I am trying to make a soap server with the attribute OptIn in WCF / .net 4.0
This is my test code
[DataContract]
public class Relatie
{
[DataMember(IsRequired = false)]
public string Emailadres{ get; set; }
}
This will give a result without the OptIn, what must i add or change to specify this option?
<Relatie>
<EmailAdres OptIn="true">mail@domein.com</EmailAdres>
</Relatie>
Thanks in advance
It is not possible when using
DataContractSerializerbecause it doesn’t support XML attributes. You must use XML serializer instead:And your operation contract, service contract or service implementation must be marked with
[XmlSerializerFormat]attribute.