© Eric Vogel 2021
E. VogelBeginning Entity Framework Core 5https://doi.org/10.1007/978-1-4842-6882-7_7

7. Getting Data

Eric Vogel1  
(1)
Okemos, MI, USA
 

Now that we have loaded some sample data into our database, let us learn how to retrieve and filter it using Entity Framework Core 5. To filter data, we use LINQ either through its Query syntax or the Method syntax. I tend to use a mix of the two syntaxes to get my desired data. I will first cover the Query syntax and then explain the Method syntax. After we go over the basics of LINQ, I will show you how to test Entity Framework Core against our database through some NUnit integration tests.

LINQ Queries

I will explain the Query syntax first as I find it easier to understand. A LINQ query looks a lot ...

Get Beginning Entity Framework Core 5: From Novice to Professional 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.