WCF and nullable attributes in generated schemas

I am trying to do some contract first development and have already worked out a schema where the item has minoccurs=0

and nullable=false

. However, I am unable to create the DataContract or XmlSerializer that generates this xsd .

I have an idea that this is not possible.

The only solution I have found is ugly, see here .

In this solution, I have to implement IXmlSerializable and do the shema and serialization myself. So I would have to consider both a schema and a C # class -> Ugly

Has anyone found a solution or heard from Microsoft that this is not possible?

0


source to share


1 answer


As far as I know, both XmlSerialiser

and DataContractSerializer

will generate an object that will respect the schema if the object is populated correctly, but if the required values ​​are not populated the generated xml will not validate the schema again.



You can try to use XsdObjectGenerator .

0


source







All Articles