Lookup tables in Core Data
Core data is not a database and so I am getting confused as to how to create, manage or even implement Lookup tables in core data.
Here is a specific example that relates to my project.
Staff (1) -> (Many) Talents (1)
The talents
table consists of:
TalentSkillName (String)
TalentSkillLevel (int)
But I do not want to keep entering the TalentSkillName
, so I want to put this information into another, separate table/entity.
But as Core Data is not really a database, I'm getting confused as to what 开发者_Go百科the relationships should look like, or even if Lookup tables should even be stored in core data.
One solution I'm thinking of is to use a PLIST of all the TalentSkillNames and then in the Talents entity simply have a numeric value which points to the PLIST version.
Thanks.
I've added a diagram which I believe is what you're meant to do, but I am unsure if this is correct.
I'd suggest that you have a third entity, Skill
. This can have a one to many relationship with Talent
, which then just has the level as an attribute.
Effectively, this means you are modelling a many-to-many relationship between Staff
and Talent
through the Skill
entity. Logically, that seems to fit with the situation you're describing.
精彩评论