0

Anyone has experience of using/developing a Data Access model which uses Entity Framework only for Insert/Update/Delete and raw SQL for Reading/Querying purposes. If any, how was your experience, what are the pros and cons for such a Data Access Model.

Or do you know any open source projects that i can have inspiration which uses such a Data Access model.

P.S: By using raw SQL for querying, I dont mean using DataTables in Business Layers but, querying and creating DTO classes that maps the result of the query.

Joe Gage
  • 33
  • 9
  • You can use EF for simple queries and raw sql for very very complex queries? With row queries you need maintain manually names of columns and creation of Sql Parameters, only benefit from raw query is "Full" control of queries you send to the database server. – Fabio Apr 19 '17 at 09:08
  • Yes, I am already thinking of using EF for GetById type queries, and SQL for any other complex queries. – Joe Gage Apr 19 '17 at 11:14
  • I wonder, what is the reason you wouldn't want to use EF to read data? You can use Linq to write complex queries, and there are options to improve performance, like disable tracking. –  Apr 19 '17 at 21:29
  • For performance reasons in complex queries. I hate when linq generates thousands lines of sql query :) – Joe Gage Apr 20 '17 at 08:28

0 Answers0