Entity Framework (EF) approach

To work with EF, we need a class that inherits from the DbContext class and the DbSet object as the DbContext class properties.

Before EF, we had several approaches to working with EF:

  • The empty code first model (from C# classes used to generate a new database)
  • Code first from an existing database (generating EF entities' classes and the DbContext class, but the goal was to keep on using EF with the code first model features)
  • The empty EF designer model (in an .edmx model file via a graphic interface, we created object-oriented entities that generated a new database (schema, tables, relations, constraints) and the associated C# code.
  • The EF designer from the database (this generated an .edmx file model from ...

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.