Let's say I'm modeling a school, so I have 2 objects: a student and a class. For some reason, I want each class list to have its own sort order. In a simple connection, this would mean that the student had a sortOrder attribute and just sorted the list by that number. The problem is that a student can be of the order of 3 in one class and of the order of 6 in another. How do I store these orderings in Core Data so that I can easily access them and sort the lists correctly?
Student Class
classes <<--------->> students
^ ^
| |
unordered ordered
This chart may help explain what I'm trying to do. Students "registry", which I would like to receive in a certain order, are stored somewhere, which can be any order. Keeping this order is something that I'm not sure how to make it the most efficient. Creating a bunch of Order objects and trying to manage links sounds like a lot of overhead, and it seems like there should be a better way.
source
share