Core Data: несколько связей с одним и тем же объектом

У меня есть модель данных, которую я пытаюсь перенести из структуры таблицы на основе SQLite в модель Core Data. В моей структуре SQLite есть таблица зон и таблица TransitLogs. TransitLog может иметь следующее (в моей схеме sqlite) start_zone_id end_zone_id

Each of which is a foreign key to the zones table. This works fine in SQL. But when moving to Core Data I'm having trouble understanding how to model this.

My first attempt has me having two relationships in my TransitLog Entity with a startZone and endZone relationship attributes that point to a Zone (sorry wasn't able to post a screenshot of xcode as this is my first post here)

The question I have is how to handle the inverse relationship for the startZone and endZone relationship attributes. Do I not need them? In the documentation and books I've read on this topic, it's best to always use an inverse relationship but I'm wondering about this particular situation if it doesn't apply. Or am I simply modeling this incorrectly in Core Data.

Thanks for any advice.

Mike

5
задан MPelletier 27 January 2011 в 18:46
поделиться