Raw SQL Queries in EF-Core
Raw SQL Queries in EF-Core
Using FromSqlRaw Method instead of FromSql
Parameterized Query
// Format string
var actor = db.Actors
.FromRawSql("SELECT * From Actors Where ActorID = {0}", id).FirstOrDefault();
// String interpolation
var actor = db.Actors
.FromRawSql($"SELECT * From Actors Where ActorID = {Id}").FirstOrDefault();Composing Over Raw SQL
Change Tracking (SQL Server)
Limitations of Using Raw SQL
References
Last updated
