Mid EF Core

How to do raw SQL queries in EF Core?

(FromSqlRaw, etc.)

  • Use FromSqlRaw() or FromSqlInterpolated():

var products = context.Products

.FromSqlRaw("SELECT * FROM Products WHERE Price > {0}", 100)

.ToList();

More from Entity Framework Core Tutorial

All questions for this course