• 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: Kai BrĂ¼ning <email@hidden>
  • Date: Thu, 15 Nov 2007 10:03:18 +0100

Ben,

thanks for your answer.

>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.

Yes, this was my understanding.

>
>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.

Exactly. My idea is to load the sub-model(s) separately and create a whole separate Core Data stack to access export files.

>
>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.

That is an interesting and important way to phrase it. While technically more than understandable, this is a very unfortunate restriction of Core Data for modern application development.

Kai
_______________________________________________

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

References: 
 >re: Core Data: Cross-Model Relationships (From: Ben Trumbull <email@hidden>)

  • Prev by Date: Re: Having trouble just displaying a window
  • Next by Date: NSMenuItem target binding
  • Previous by thread: re: Core Data: Cross-Model Relationships
  • Next by thread: How to observe Core Data add/remove actions?
  • Index(es):
    • Date
    • Thread