Most of us working on ASP.Net stack has had opportunity to built ORM layer using Entity Framework most of the time. Entity Framework is favorite ORM tool tended to be typically used by .NET developers to work with database using C# POCO objects. There are trade-offs associated with the abstraction provided by EF when compared with raw performance you get by raw SQL queries or directly using ADO.Net layer. Query performance suffers a bit when using abstractions like Entity Framework. However, all is not lost. There are optimizations, tips and Microsoft has invested heavily on Entity Framework improving it’s performance.
But, on a day-to-day developer maintaining an application, there will be certainly requests to get ride of performance bottlenecks and to improve the application responsiveness and throughput. One key area where performance can be improved is your data access logic.
we like to share with you an excellent article on how to improve EF Query performance using a precise surgical approach which includes writing proper LINQ query which can fully translate to SQL query, making use of Db functions and in some cases using Dapper query approach
Check this article which builds on a practical example