c# - Cannot deserialize object graph into object with inheritance hierarchy -
I have a way in which the following methods are included:
[WebMethod ] There is a hereditary hierarchy like this: DayEntry-> DataEntry-> DayEntryLD
Public Nine Savendents (list of & lt; DayEntry & gt; listofEntries, string language) / P>
And there is an interface, so I have to take DayEntry and can not take DayEntryLD
On the customer side, I can create an array by type of DayEntryLD and thus / saveDayEntries Send to web service Note :.
$ .ajax ({type: "post", url: "DataProviderFD.asmx / saveDayEntries", contentType: "application / json; charset = utf-8", datatype: "json" , Async: incorrect, data: "{'listofEntries':" + JSON.stringify (data) + ", 'language': '" + lang + "'}"});
If I execute the code, I get the following error: "Object graph can not be horizontal in the type of day interval"
I think I understand this problem, how to fix this? Does anyone know about this? Thx
Have you tried commenting the service method with the XmlInclude feature? You need to specify such an attribute for every derived type in the hierarchy
[WebMethod] Public Zero saveDayEntries (List of & lt; DayEntry & gt; listofEntries, string language) {} [XmlInclude (typeof (DataEntry)] [XmlInclude (typef (Data EntryLD))] Class Days Entry {}
Comments
Post a Comment