You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With current EFCore 9 (and I believe since 7?) the .SqlQuery method does not accept any arguments except for the query itself. I believe it's supposed to function like .FromSql, where interpolated strings are automatically parameterized, hence the existence of .SqlQueryRaw.
Either the documentation is outdated/incorrect, or this code is going to cause sql injection attacks to become more prevalent.
@roji You and I agree on that. The documentation says otherwise, though. From the doc page:
You can include parameter place holders in the SQL query string and then supply parameter values as additional arguments. Any parameter values you supply will automatically be converted to a DbParameter.
Type of issue
Outdated article
Description
With current EFCore 9 (and I believe since 7?) the
.SqlQuery
method does not accept any arguments except for the query itself. I believe it's supposed to function like.FromSql
, where interpolated strings are automatically parameterized, hence the existence of.SqlQueryRaw
.Either the documentation is outdated/incorrect, or this code is going to cause sql injection attacks to become more prevalent.
Page URL
https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.relationaldatabasefacadeextensions.sqlquery?view=efcore-9.0
Content source URL
https://github.com/dotnet/EntityFramework.ApiDocs/blob/live/dotnet/xml/Microsoft.EntityFrameworkCore/RelationalDatabaseFacadeExtensions.xml
Document Version Independent Id
731055e2-2c41-b2bf-4d08-8d06cd1d6cc5
Article author
@dotnet-bot
The text was updated successfully, but these errors were encountered: