From 1c48a8c9c9d8a6f43ae83d85112f58cd02306c66 Mon Sep 17 00:00:00 2001 From: Kevin Matsubara Date: Tue, 8 Apr 2025 22:37:56 +0200 Subject: [PATCH] Add note about JOINs in SQL queries. --- EntityFrameworkCore.Console/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/EntityFrameworkCore.Console/Program.cs b/EntityFrameworkCore.Console/Program.cs index 50bcd48..7524365 100644 --- a/EntityFrameworkCore.Console/Program.cs +++ b/EntityFrameworkCore.Console/Program.cs @@ -65,6 +65,9 @@ async Task RawSQLStatement() Console.WriteLine($"SQL Raw Team: {t.Name}"); } + // Note, that you cannot use JOINs in these SQL queries. + // Instead, the Include() function is used to add related data. + // FromSqlInterpolated is the revised form of FromSql, and a better choice. teams = context.Teams.FromSqlInterpolated($"SELECT * FROM Teams WHERE name = {teamName}"); foreach (var t in teams)