• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re: Core Data: Cross-Model Relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Core Data: Cross-Model Relationships


  • Subject: re: Core Data: Cross-Model Relationships
  • From: Ben Trumbull <email@hidden>
  • Date: Wed, 14 Nov 2007 16:46:31 -0800

Kai,

So far, so easy: +[NSManagedObjectModel modelByMergingModels:] will
merge my sub-models nicely. But I need some cross-sub-model
relationships. My idea is to create these relationships
programmatically after the sub-models have been loaded and merged
into one model.

Questions:

- Is this feasible and a good idea?
- Does my whole consideration make sense?
- Is there a better/easier way to achieve what I want?

On the whole what you propose makes sense. There is one delicate consideration. When you open a store file, the model you use must match exactly the model used to create the store. No more, no less.


So two points come up. Any programmatic alterations to a model must be maintained. If you add some code, and then save some files, you can't change your mind later about what programmatic alterations to make without performing a schema migration.

Secondly, the sub-stores and sub-models cannot at runtime actively use a subset of the primary model. They either need to exactly use the primary model, or have their own NSPersistentStoreCoordinator with their own precise model.

Or put another way, Core Data doesn't support dynamic plugins to the model without either a different coordinator, a schema migration step, or both.
--


-Ben
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • re: Core Data: Cross-Model Relationships
      • From: Kai BrĂ¼ning <email@hidden>
  • Prev by Date: Re: Adding/removing managed objects: how to know the maximum index?
  • Next by Date: File system visiblilty
  • Previous by thread: Core Data: Cross-Model Relationships
  • Next by thread: re: Core Data: Cross-Model Relationships
  • Index(es):
    • Date
    • Thread