A parameterized query keeps user-supplied values separate from the SQL command structure. This prevents input from being interpreted as SQL code and blocks SQL injection attacks. section 29.4.2
Use parameterization whenever application input becomes part of a database request:
- Avoid building SQL with string concatenation, even when the input appears harmless. section 29.4.2
- Use standard LINQ queries with EF Core when possible; EF Core creates parameterized SQL automatically. section 29.4.2
- Apply the same principle to low-level ADO.NET and to NoSQL or document databases that provide an equivalent mechanism. section 29.4.2
Separating a search value from SQL
In EF Core, a placeholder keeps the search value separate from the SQL command: `FromSqlRaw("SELECT * FROM Recipes WHERE Name = '{0}'", search)`. An attempted value such as `'; DROP TABLE Recipes; --` is treated as input rather than executable SQL. section 29.4.2







