Re: Core Data Model "Configurations"?
Re: Core Data Model "Configurations"?
- Subject: Re: Core Data Model "Configurations"?
- From: Chris Hanson <email@hidden>
- Date: Sun, 31 Jul 2005 21:47:48 -0700
On Jul 31, 2005, at 7:56 PM, Keith Renz wrote:
Can someone please elaborate on "configurations" in relation to
Core Data, Entities, etc? The Xcode 2.1 User Guide, p 160,
Configuration Pane, says, "A configuration is a named collection of
entities in the model."
This is exactly what a configuration is when it comes to Core Data.
You can create a configuration of your model that contains only some
entities. Then, when you ask a persistent store coordinator that's
using your model to add a persistent store, you can specify that it
should add the store using the configuration. What this means is
that when you save, only entities defined in that configuration will
be saved in that persistent store.
For example, let's say you have a coordinator. You add persistent
store A to it using configuration Foo and persistent store B to it
using configuration Bar. Then you insert some instances of entities
from both configurations in a context attached to the coordinator,
and save the context.
The instances of entities from configuration Foo will be saved in
persistent store A, and the instances of entities from configuration
Bar will be saved in persistent store B, all automatically. In other
words, you don't need to use -[NSManagedObjectContext
assignObject:toPersistentStore:] to specify which persistent store
each instance belongs in.
Be careful not to create relationships from instances in one
persistent store to instances in another persistent store. That's
not supported in Core Data.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden