We have explored how to execute raw SQL queries in EF Core without providing direct ADO.NET implementation, and have a consistent implementation of the Data Access layer. We started with a simple SQL query, then looked at the security threats (SQL injection) it would expose us to. We have overcome those threats by using parameterized queries and stored procedures. We saw the ways available to marry (composing with LINQ) Entity Framework with raw SQL query execution, leveraging the same with Include functionality. Finally, we executed raw SQL queries without DBSet and the POCO model, even though there is no built-in support in EF Core.
So far, we have been accessing the data through LINQ to SQL or raw SQL queries without any pattern applied. In Chapter 8, Query Is All We Need – Query Object Pattern, we will figure out how to apply query-related patterns...