I'm making a school planner app and I'm having a heck of a time with core data. I have an EXTREMELY advanced data model. Here is what I've got so far:
As you can see, I wasn't kidding about the level of simplicity. Let me explain it.
A course is the main relational entity here; however, none of the attributes or relationships are required. There can be multiple courses. Each course can optionally contain a name and location. Each course can also optionally contain multiple classDay and teacher entities (many-to-many relationship) and one period entity (many-to-one relationship).
And of course, all of these can be inverted: While a course can be on multiple class days, a class day can be associated with multiple courses. While a course can have multiple teachers, a teacher can teach multiple courses. And finally, While a course can be during one period, a period can be associated with one course. Also, a period can be during one PeriodTime.
A course can also have multiple assignments; however, an assignment can only be for one course. An assignment can also be of multiple types and vise versa.
When you delete a course, all of the assignments associated with it are deleted as well. When you delete a period, the period's time is deleted as well. And when you delete an assignment type, all the assignments associated with that type are deleted as well.
-------------------------------
Like I said, VERY complex. I guess my question is: how would I deal with so many different relationships like this? Would I need multiple managedObjectContexts for each different relationship? Sorry for the long question. I've been working at this for about a week and a half now and it's driving me crazy!