I have generated a WCF proxy from a WSDL file and are having problems with a property/field.
The propertie is of a complex type(class) and is decorated with the following attribute in the generated code.
XmlElementAttribute(IsNullable=true)
When the propertie is not set to an object the serializer will still generate it in the XML like this
<OpDDoctorInfo xsi:nil="true" />
I need it to not be generated at all.
I really dont like to change in a generated proxy file but I dont seem to have any other choise?
From this link I can see that if there is a default value and the value that is set is the same then the default behavior will be to exclude it from the xml so why have it been generetad with a attribute like this?
Edit: some thinks that this is a dubblicate of this :
What is the correct way to represent null XML elements?
It is not, that questions asks what the correct way is to handle null. Im asking how to remove the propertie/field from the generated XML while using a generated proxy class. Maybe I have to change in the proxy generated code or is there a better way?