views:

44

answers:

2

Consider that i have two entities with following relationship:

Entity A <-->> Entity B (one-to-many and inverse)

Now consider that i have another entity Entity C that contains all the attributes of Entity B and some others, with following relationship:

Entity A <-->> Entity C (one-to-many and inverse)

Now i can improve the architecture by making Entity B the parent of Entity C.

Entity B
   ^
   |
Entity C

Now, my question is, will the attribute(s) AS WELL AS the relationship(s) be inherited by Entity C? Meaning, do i still need to keep the following relationship (separately)?:

Entity A <-->> Entity C

Also, i couldn't find a good example for entity inheritance in Apple documentation for Core Data. Does anyone know of an online resource that explains this, with example (preferably)?

+1  A: 

Now, my question is, will the attribute(s) AS WELL AS the relationship(s) be inherited by Entity C? Meaning, do i still need to keep the following relationship (separately)?:

Yes all attributes and relationships are inherited. Only little documentation is available at ADC

Martin Brugger
But, the documentation only refers to "properties" and not "relationships", which is why i posted this question here. Thanks for the reply.
Mustafa
attributes + relations == properties, so the documentation is right, still it could be a little more helpful.
Martin Brugger
+2  A: 

Yes, attributes and relationships and everything else will be inherited. Be careful though, child entities like that will share the same table in sqlite with the parent entity. So if you have C inheriting from B, then a table will be created in sqlite that has the properties for both B and C which the obvious voids in the table. This is not too much of an issue with a simple inheritance like this but if you decide to get "creative" you can end up with your entire model in one table.

Marcus S. Zarra
Thanks for sharing the relevant information.
Mustafa