Re: CoreData - multiple stores advice...
Re: CoreData - multiple stores advice...
- Subject: Re: CoreData - multiple stores advice...
- From: Martin Linklater <email@hidden>
- Date: Tue, 29 Jan 2008 04:50:28 -0800
On Friday, January 25, 2008, at 04:12PM, "mmalc crawford" <email@hidden> 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
_______________________________________________
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