Getting the Generated SQL

Learn about viewing the SQL generated by EF Core which allows us to quickly see the SQL queries generated by our code.

Analyzing generated SQL queries

We might wonder how well-written the SQL statements are generated from the C# queries we write. EF Core 5 introduced a quick and easy way to see the SQL generated:

Step 1: In the FilteredIncludes method, before using the foreach statement to enumerate the query, add a statement to output the generated SQL, as shown in ...