How can I optimize performance in a .NET 8 Web API when using Entity Framework Core with complex queries?

Eng. Feras Musallam
20
Reputation points
I'm building a .NET 8 Web API using ASP.NET Core and Entity Framework Core 8 with SQL Server. I'm running into performance issues when retrieving data that involves multiple related tables (e.g., nested includes, projections, and filtering on joins).
I want to:
Improve response time without sacrificing maintainability
Minimize memory usage during data retrieval
Explore patterns or libraries (e.g., Dapper, compiled queries, CQRS) if EF Core can't handle it efficiently
Sign in to answer