学习路线:
Core Data Tutorial for iOS
Core Data Utility Tutorial
Core Data Programming Guid
code: CoreDataBooks
Core Data Model Versioning and Data Migration Programming Guide
Atomic Store Programming Topics
Incremental Store Programming Guide
Xcode Tools for Core Data
Xcode Mapping Tool for Core Data
Cocoa Bindings Programming Topics
???: 实现SELECT 部分字段效果用:
NSExpression 的
expressionForKeyPath:
和
NSExpressionDescription ?
[fetchRequest setPropertiesToFetch:[NSArray arrayWithObject:expressionDescription]];
context -‐-‐-‐> coordinator -‐-‐-‐> model
1. Managed Object Model
is an object representation of a schema that describes your database
is a collection of entity description objects (instances of
NSEntityDescription).
2. A persistent object store
represents an external store (file) of persisted data
When you fetch records, Core Data retrieves results from all of them (unless you specify which store you’re interested in).
3. A managed object
is
an object representation of a record in a table in a database
A managed object is associated with an entity description (an instance of
NSEntityDescription)
that provides metadata about the object (including the name of the entity that the object represents and the names of its attributes and relationships)
4. The managed object context
manage a collection of managed objects. These objects form a group of related model objects that represent an internally consistent view of one or more persistent stores.
5. 一个Entity 可以 用于存放不同的store..
You specify the store for an object using the
NSManagedObjectContext
method,
assignObject:toPersistentStore:.
Transient properties
are properties that you define as part of the model, but which are not saved to the persistent store as part of an entity instance's data.
an attribute is optional—that is, it is not required to have a value
Fetched properties represent weak, one‐way relationships
可以
cross stores.
Relationships
represent to-many relationship
不能
cross stores.
Faulting :
a managed object may be a “fault”—an object whose property values have not yet been loaded from the external store
When you fetch a managed object, Core Data does not automatically fetch data for other objects to which it has relationships