4.1. Methods of Interacting with a Database

Entity Framework assumes three possible methods for interacting with a database:

Database first

Entity Framework creates a set of classes that reflect the model of an existing database.

Model first

The developer creates a database model that Entity Framework later uses to create an actual database on the server.

Code first

The developer creates a class for the model of the data that will be stored in a database and then Entity Framework uses this model to generate the database and its tables

Our sample application will use the Code first approach, but you could use one of the others just as easily.

As we already have a database, we will just write the code that would result in creating that database.