Entity Framework Include Optimized Library
Entity Framework Include Optimized library allow you to optimize the query generated by EF by executing multiple smaller queries instead of executing only one monster SQL.
Why using Include Optimized with Entity Framework?
- The SQL generated by Entity Framework is too big and take several seconds or minutes to be executed.
Google – Related Searches
Stack Overflow – Related Questions
|// SELECT * FROM Order WHERE….|
|// SELECT * FROM OrderItem WHERE EXISTS (/* previous query */) AND …|
|// SELECT * FROM DeliveryItems WHERE EXISTS (/* previous query */) AND …|
|var orders = ctx.Orders|
|.Where(x => x.OrderId == myOrderID) // 1 orders, 20 columns|
|.IncludeOptimized(x => x.Items) // 20 items, 10 columns|
|.IncludeOptimized(x => x.DeliveredItems) // 10 items, 10 columns|
Use them at your risk!