Database Reference
In-Depth Information
object model, we mean we are editing the source file in Xcode that will get
compiled and used by the NSManagedObjectModel . From a database perspective,
this file represents the schema of the database. In Xcode, this file is shown
in two different styles; the easiest to recognize is shown in Figure 1, The data
model , on page 2 .
Figure 1—The data model
While this view is great for conceptualizing the data and the objects, it is not
great for editing. Therefore, the style can be changed using a control in the
lower-right corner called Editor Style. The second style is shown in Figure 2,
The data model in grid view , on page 3 .
At its most basic level, Core Data is an object graph designed to manage data
objects. It is common when you are first approaching Core Data to think of
it as an object-relational mapping framework—and in truth, it can be used
as such. However, that is not the best approach. My elevator pitch for Core
Data goes like this: “Core Data is an object graph that can persist to a
database.” The primary function of Core Data is to manage the object graph.
Persisting the data to disk is a secondary, although vital, function.
With that in mind, the NSManagedObjectModel —and, by extension, the associated
source file in the object model—is what we think of when we need to change
the object model. The source file is saved as an .xcdatamodel file. In Xcode 4,
this file is actually a bundle with an XML document stored inside. In prior
versions of Xcode or in older project files, it's a bundle containing two binary
files. In either version, it is best to edit this file only from within Xcode.
 
 
 
Search WWH ::




Custom Search