Search code examples
iphoneioscocoacore-dataentity-relationship

Core Data how to avoid additional entity?


Simple question: I have a many-to-many relationship between sales reps and contacts:

SalesRep <<---------------->> Contact

For each contact, each sales rep can specify if he is a favorite (BOOL isFavorite) and keep some notes (NSString *notes).

The way this is currently modeled is with an interim entity:

SalesRep <------>> Relationship <<-------> Contact

where the additional information is kept in two attributes of the Relationship entity.

Is there a way around the new Relationship entity, just modeling this with additional attributes? How about if the notes field is omitted? Is there maybe a solution with parent / child entities?


Solution

  • Apparently, there is no real opportunity for simplification.
    This is viewed as the cleanest solution.

    Thanks guys.