Abstract class serialization issue

We have lots of Inheritance in our class model, and one of the requirements is to enable to get from a view or as a bulk of documents list of items that have the same base class.
googling the issue brought me to this this thread : http://stackoverflow.com/questions/6348215/how-to-deserialize-json-into-ienumerablebasetype-with-newtonsoft-json-net , So according to it , i tweaked the serializer with the correct settings, and still i cannot get a list of base class neither through view nor through bulk fetch. i suspect the reason is that the documents do not have common list in cache that tells them what is theirs base class, is there another solution to it ? I’m wandering how come it worked for me when i used binary serialization.


@gelibter -

What SDK version are you using? This is question is more about the serialization API (newtonsoft) and serialization in general than the Couchbase SDK, but I will see if I can help.

The reason you cannot serialize your base class is likely because abstract classes cannot be instantiated. If you removed the abstract keyword, you’ll probably find you get a document with the common fields, but nothing from any derived classes; their is not Type enough information about these classes to reflect upon.


Hi and thank you for your response,

We are using .net 1.3.6 client.
This is not newtonsoft question because it works there, i’v tried what the link i posted says, and it worked. the thing is that i need to keep in cache series of items that have common base class. there is no known way for me to cache them with the information about the base class so when i’ll bulk-get them i could relate them all as their base class, (as it is standard practice in object oriented programming). Again, i’m wondering about this issue since the problem raised only after we stopped working with binary and moved to json.

Thanks in advance