How to generate DataContract code from given xsd schema file

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have gotten some XSD schemas, and I need to create an interoperable (both Java and .NET consumers) WCF service that accepts and returns objects according to these schemas. Instead of handcrafting the DataContracts so they match the schemas I would like
to autogenerate my DataContract code from these schemas.
I tried Wcf.Blue but I found it did not include any [DataContract/DataMember] tags in the code because it uses XMLSerializer.<br/>
I tried using svcutil /dconly on the xsd files, but svcutil cant handle maxOccurs>1 on some elements. The XSD schemas specify some elements with maxOccurs="unbounded" as complexTypes containing another sequence. I know svcutil might have issues with
this.
So my question is what would be the best way to autogenerate my DataContracts from XSD schema files?
Im using .Net 4 by the way.
Complete XSD sample was too long to post here. A link to the XSD can be found at
http://www.fransson.net/source/sample_xsd.txt http://www.fransson.net/source/sample_xsd.txt .
Thanks in advance! <hr class="sig http://www.fransson.net

View the full article
 
Back
Top