Realm-dotnet: IList declarations need more work to enable Standalone objects with relationships

Created on 11 Dec 2015  路  7Comments  路  Source: realm/realm-dotnet

This is a concern as I thought they were working and heavily tested.

If you replace RealmList with IList in the declarations in RelationshipTests.cs then all the tests apart from the _TopDog_ tests will fail. I'm not sure if this is a problem with Fody or the RealmList classes.

T-Bug

Most helpful comment

Sam Ritchie commented during the review today that this is normal syntax in Couchbase and other ORMs which increases the importance of supporting it.

All 7 comments

The IList properties work only on stand-alone objects which are subsequently attached. Realm.CreateObject doesn't replace the List with a RealmList the same way Realm.Attach does.

Thanks for clarifying that Yavor. I knew I'd seen them working in one context - was wondering if we'd had a bad merge. This doesn't affect our MVP going out. Docs online

Sam Ritchie commented during the review today that this is normal syntax in Couchbase and other ORMs which increases the importance of supporting it.

492 Being able to define an IList of realm objects with a setter in a model is essential to being able to deserialize a root level Json doc into more than 2 levels deep i.e. (Parent < Child). Do you know where ILists are currently on the priority list?

@CrimsonKyle is the concern over having a setter or using IList in the declaration? The setter may come earlier as improving initialisation syntax is a passionate goal of mine too. The JSON decoding is a great scenario to help bump the priority of this task.

Not certain, but we think the Newtonsoft deserializer is unable to map the child RealmLists without a set method. @CrimsonKyle was able to verify non-Realm objects using IList properties with { set; } were able to deserialize the entire tree of objects while Realm inherited objects with RealmList stop deserializing at the first level.

Whilst this is working with the current commit, based on a discussion with @fealebenpae I am going to rewrite it to avoid generating a return RealmList all the time and allow init with simple braced expressions even if you just declare the get without set.

Was this page helpful?
0 / 5 - 0 ratings