1 Introduction to Entity Framework Core


This chapter covers

  • Understanding the anatomy of an EF Core application
  • Accessing and updating a database with EF Core
  • Exploring a real-world EF Core application
  • Deciding whether to use EF Core in your application

Entity Framework Core, or EF Core, is a library that software developers can use to access databases. There are many ways to build such a library, but EF Core is designed as an object-relational mapper (O/RM). O/RMs work by mapping between two worlds: the relational database, with its own API, and the object-oriented software world of classes and software code. EF Core’s main strength is allowing software developers to write database access code quickly in a language that you may know better than SQL.

EF Core is multiplatform-capable: it can run on Windows, Linux, and Apple. It does this as part of the .NET Core initiative—hence the Core part of the EF Core name. .NET 5 covers the whole range of desktop, web, cloud, mobile, gaming, Internet of Things (IoT), and artificial intelligence (AI), but this book is focused on EF Core.

1.1 What you’ll learn from this book

1.2 My “lightbulb moment” with Entity Framework

1.3 Some words for existing EF6.x developers

1.4 An overview of EF Core

1.4.1 The downsides of O/RMs

1.5 What about NoSQL?

1.6 Your first EF Core application

1.6.1 What you need to install

1.6.2 Creating your own .NET Core console app with EF Core

1.7 The database that MyFirstEfCoreApp will access

1.8 Setting up the MyFirstEfCoreApp application

1.8.1 The classes that map to the database: Book and Author

1.8.2 The application’s DbContext

1.9 Looking under the hood of EF Core