gonzalezreal / Groot

From JSON to Core Data and back.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce `identityProperties` over `identityProperties ` annotation

fabiomassimo opened this issue · comments

commented

In my Data Model I have an entity A that has a relationship one-to-many to entity B.
When implementing the proper userInfo keys for B I'd like to use as identityAttributes a combination of an attribute in B and an attribute in A (for which B has an inverse relationship), such that I can uniquely identify an object in B for every unique object A.

Wouldn't it be better to use propertyByName instead of attributeByName to match the values that uniquely identifies an entity?
It could be something like identityProperties that gives the opportunity to also include attributes within other objects in a relationship.

I am not sure if that is even possible to accomplish. Will have a look into it.

commented

Thanks for your reply.
May I ask your opinion about this small update in my fork?
The idea is that when Groot tries to set a relationship, by serializing a JSON object, the relationship is preserved to make sure only objects in the relationship are updated.

Thank you for your time.

fabiomassimo@1ab1484

Sorry for lack of tests, I'll add it as soon as possible and if you find it ok maybe open a PR.