Database Reference
In-Depth Information
3. NSBinaryStoreType is backed by a binary data file. Like NSXMLStoreType , it is
also an atomic store, so the entire binary file must be loaded onto memory before
you can do anything with it. You'll rarely find this type of persistent store in real
world applications.
4. NSInMemoryStoreType is the in-memory persistent store type. In a way, this
store type is not really “persistent.” Terminate the app or turn off your phone,
and the data stored in an in-memory store type disappears into thin air. Although
this may seem to defeat the purpose of Core Data, in-memory persistent stores
can be helpful for unit testing and some types of caching.
Note: Were you holding your breath for a persistent store type backed by a
JSON file or a CSV file? Bummer. The good news is that you can create your
own type of persistent store by subclassing NSIncrementalStore .
Refer to Apple's Incremental Store Programming Guide if you're curious about
this option:
https://developer.apple.com/library/ios/documentation/DataManagement/Con
ceptual/IncrementalStorePG/Introduction/Introduction.html
The persistent store coordinator
NSPersistentStoreCoordinator is the bridge between the managed object model
and the persistent store. It is responsible for using the model and the persistent
stores to do most of the hard work in Core Data. It understands the
NSManagedObjectModel and knows how to send information to, and fetch information
from, the NSPersistentStore .
NSPersistentStoreCoordinator also hides the implementation details of how your
persistent store or stores are configured. This is useful for two reasons:
1. NSManagedObjectContext (coming next!) doesn't have to know if it's saving to an
SQLite database, XML file or even iCloud.
2. If you have multiple persistent stores, the persistent store coordinator presents a
unified interface to the managed context. As far as the managed context is
concerned, it always interacts with a single, aggregate persistent store.
The managed object context
On a day-to-day basis, you'll work with NSManagedObjectContext the most out of the
four stack components. You'll probably only see the other three components when
you set up your stack or do a migration.
 
 
Search WWH ::




Custom Search