Skip navigation.
 
mlRe: CoreData - multiple stores advice...
FROM : Martin Linklater
DATE : Tue Jan 29 13:50:28 2008

On Friday, January 25, 2008, at 04:12PM, "mmalc crawford" <<email_removed>> wrote:
>See <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdBasics.html#//apple_ref/doc/uid/TP40001650-207422-TPXREF147

> > and <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdChangeManagement.html

Sorry for my further questions, but I've read those docs and I'm still unsure how to actually create what I want. What I want is a setup similar to figure 5 in the 'Core Data Programming Guide-
>Core Data Basics' page in the docs... only I'm going to have one MOC at the top rather than many.

So Ii have one Persistent Store Coordinator.

I have multiple Persistent Stores - each with it's own Store and Managed Object Model.

But how do I actually create this in code ? The only way to create a Persistent Store Coordinator is to give it a MOM...[NSPersistentStoreCoordinator initWithManagedObjectModel] - but I have mutiple MOMs - one for each Store... which one do I pass in ?

If I just create the Persistent Store Coordinator with 'init' and then add the stores with 'addPersistentStoreWithType', how do I tell it which MOM to associate with each Store ? The API doesn't seem to let me do this...

I could always create the NSPersistentStores myself using [NSPersistentStore initWithPersistentStoreCoordinator], but then I need to pass in a 'managed object model configuration'  - what's this ? I have my managed object models - what is the 'configuration' bit ?

in fact, I have no idea what the 'configuration' parameter does in either of the above init calls - are the details documented anywhere ?

Doh - I'm confused..... I've read the docs multiple times and watched the WWDC vids, and I'm comfortable with the concepts, but when I look at the API and think about how I'm actually going to write the code I hit a blank.

Can anyone point me at an existing example or sample code which goes through my desired setup and shows me how to do it with the API ? Or write a few lines out to get me going inthe right direction... What order do I create things in, and how do I link them ?

Thanks for your help - there must be some mental leap that I'm having trouble making somewhere...

- Martin

Related mailsAuthorDate
mlCoreData - multiple stores advice... Martin Linklater Jan 25, 13:34
mlRe: CoreData - multiple stores advice... Martin Linklater Jan 25, 14:48
mlRe: CoreData - multiple stores advice... mmalc crawford Jan 25, 17:12
mlRe: CoreData - multiple stores advice... William Turner Jan 25, 17:17
mlRe: CoreData - multiple stores advice... Martin Linklater Jan 29, 13:50
mlRe: CoreData - multiple stores advice... mmalc crawford Jan 29, 14:06
mlRe: CoreData - multiple stores advice... Martin Linklater Jan 29, 15:57
mlRe: CoreData - multiple stores advice... mmalc crawford Jan 29, 16:45
mlRe: CoreData - multiple stores advice... Martin Linklater Jan 29, 18:12
mlRe: CoreData - multiple stores advice... mmalc crawford Jan 29, 18:17