I had a rather frustrating day at the office. We have a datamodel with a complex structure. Complex in the way that it uses collections and custom entities as properties. To give an example
public class ClassA
{
public string Name;
public ClassB ClassB
public List<ClassC> ClassCs
}
I have trouble to put it to Dictionary<string, object> and back to a ClassA object. Are there any CBL-followers here that have to deal with the same issue? Any takes on this?
In light of 2.0.0 I was wondering if it is worth the effort and time I should put in it. As I remember correctly and thus dug up:
Should I just convert the more complex properties to Json at present time or is there a future-proof approach until a more complete 2.0.0 is released?
@borrrden, our .NET engineer, is out on vacation until tomorrow.
We’ve had to postpone the model-classes feature from 2.0, unfortunately. It’ll be in 2.1. AFAIK, .NET has a number of ways to help convert custom objects to plain-old-.NET-objects, but I don’t know .NET so I can’t actually help here…
thanks for your reply. Thus far I’ve worked it out by serializing each property that is not a value type to json. I have left the reflection path. Works fine for now
I have created a base .NET class that stores a Dictionary loaded/saved from a CBL Document, and subclasses for the document types which have property accessors to serialize/deserialize the value to/from the Dictionary. Array properties are serialized to an IArray object. Object sub-properties are (de)serialized to a sub-property class.