The FromSqlInterpolated method in Entity Framework Core is used to execute a raw query that contains interpolated parameters. Interpolated parameters are replaced with actual values at runtime, which helps to protect against SQL injection attacks. For simple queries like the example above, using LINQ would be preferable, both for safety and for leveraging the benefits.

1m read timeFrom davecallan.com
Post cover image
Table of contents
Use raw SQL with cautionYou might also be interested in...

Sort: