2 Querying the database

This chapter covers

  • Modeling three main types of database relationships
  • Creating and changing a database via migration
  • Defining and creating an application DbContext
  • Loading related data
  • Splitting complex queries into subqueries

This chapter is all about using EF Core for reading, called querying, the database. You’ll create a database that contains the three main types of database relationships found in EF Core. Along the way, you’ll learn to create and change a database’s structure via EF Core.

Next you’ll learn how to access a database via EF Core, reading data from the database tables. You’ll explore the basic format of EF Core queries before looking at various approaches to loading related data with the main ...

Get Entity Framework Core in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.