Building and executing parameterless queries would have fewer usages, whereas most usages in any application would be based on parameters/conditions. Introducing parameters in flat/raw queries would expose us to a threat of SQL injection. How are we going to protect our application from such a threat? We cannot ignore them in a real-world application, as we have applications that are hugely dependent on inline queries.
Building parameterized queries
SQL injection is a technique used by hackers to exploit any system, and it would shake it to its core in terms of security. It could be performed by embedding user inputs blindly with inline SQL queries.
The most commonly injected value would be OR 1 = 1 , which would pump an entire record set ...
Get Mastering Entity Framework Core 2.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.