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 data, such as loading the author with the book from chapter 1.
After learning the ways to load related data, you’ll start to build the more complex queries needed to make a book-selling site work. This task covers sorting, filtering, and paging, plus approaches that combine these separate query commands to create one composite database query.
TIP
I use unit tests to ensure that what I write in this book is correct. You might like to look at/run these unit tests, as they may help you understand what is going on. You can find them in the associated GitHub repo at http://mng.bz/XdlG. Look at the Readme file in the repo for information on where to find the unit tests and how to run them.