We have a pretty lengthy xsd and we generated c# DTO class using xsd.exe. We need to mark our classes as DataContract
and its memebers as DataMember
as we we want to use DataContractSerializer
than XML.
I was able to mark classes and memebers appropriatley but while trying to run code, I am getting below KnownType exception
, I tried adding all KnownType
on all the classes but the errors are on similar lines. I haven't been able to find any solution for this. Can some one please suggest that how do we use DataContract
on the file generated through xsd.exe.
Consider using a DataContractResolver if you are using DataContractSerializer or 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 the serializer.System.ServiceModel.CommunicationException:
I tired svcutil and it gives me tons of errors and also doesn't generate output as expected while XSD does.