I have used xsd.exe tool to generate data class but wcf doesn’t like the data class to be exchanged and throws an error
“There was an error while trying to serialize parameter http://tempuri.org/:orderItems. The InnerException message was ‘Type ‘Store.Schemas.Order’ with data contract name ‘Order:http://schemas.datacontract.org/2004/07/Store.Schemas’ is not expected. Add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.’. Please see InnerException for more details.
“
There are a lot of classes that comes based of XSD. As per MSDN , it says http://msdn.microsoft.com/en-us/library/ms751512.aspx , every data classes to be decorated with KnownTypeAttribute,DataContractAttribute, DataMemberAttribute etc.
Is there a way where I can generate data class from xsd that can be used with WCF service? because changing the class generated by XSD.exe is not recommended nor easy process.
http://wscfblue.codeplex.com/ open source generator solved the problem