The Code First approach follows conventions over the configuration but it also gives us two ways to add a configuration on over classes.One is using simple attributes called Data Annotations and another is using Code First's Fluent API, that provides you with a way to descried configuration imperatively, in code.This chapter also demonstrates how to add, edit, and delete data, how to fetch data, and how to use predicates to fetch specific data.With this knowledge, you will have a good foundation for implementing Core Data quickly in your apps.Core Data is an object graph and persistence framework provided by Apple in the Mac OS X and i OS operating systems.It was introduced in Mac OS X 10.4 Tiger and i OS with i Phone SDK 3.0.
Both tables, Customer and Order, will have the relationship one-to-many so whenever we retrieve all orders of a customer then we can easily retrieve them. In this article I will cover the following: Entity Framework Code First allows us to use our own domain classes to represent the model that Entity Framework relies on to perform querying, change tracking and updating functions.
The sample app for this chapter is called My Movies.
It is a Core Data–based app that will keep track of all your physical media movies and, if you have loaned a movie to someone, who you loaned it to and when (as shown in Figure 13.1).
But for those who do not want to start from the very beginning, you can download this Xcode project to continue to work on the below tutorial.
In the last tutorial, we already discussed how to fetch and save a managed object using Core Data API.