Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data Model "Configurations"?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Core Data Model "Configurations"? (From: Keith Renz <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.