Database Reference
In-Depth Information
binary data of this size should be stored on disk as opposed to in the reposi-
tory. When working with data of this size, it is best to store its path information
directly in the primary entity (such as the Recipe entity) and store the binary
data in a known location on disk (such as in the Application Support subdi-
rectory for your application).
Entity Inheritance
Entity inheritance is a very powerful feature within Core Data. It allows you
to build an object-like inheritance tree in your data model. However, this
feature comes at a rather large cost. For example, let's look at an example
model that makes moderate use of entity inheritance, as shown here:
The object model itself looks quite reasonable. We are sharing name , desc , and
a one-to-many relationship to the ImageEntity . However, the underlying table
structure actually looks like this:
The reason for this is how Core Data handles the object model to relational
table mapping. Instead of creating one table for each child object, Core Data
creates one large table that includes all the properties for the parent entity
as well as its children. The end result is an extremely wide and tall table in
the database with a high percentage of empty values.
Although the entity inheritance feature of Core Data is extremely useful, we should
be aware of what is going on underneath the object model to avoid a performance
penalty. We should not treat entity inheritance as an equal to object inheritance.
There is certainly some overlap, but they are not equal, and treating them as such
will have a negative impact on the performance of the repository.
 
 
Search WWH ::




Custom Search