I am currently using the following method to get a page of customers as well as the total count. The only problem is that I am making 2 database trips - one for getting the
I thought and research a lot on this issue. Right now and with EF 6, there are 2 good practices:
(1) The first solution is to have a Stored Procedure (I know, I Know, you usually want to avoid Stored Procedures when you work with EF, go to solution 2 then!), which returns multiple results. This article explained it:
Entity Framework Sprocs with Multiple Result Sets
(2) The second best practice is to use "Query Future" feature of Entity Framework Plus package. This is a very cool extension to Entity Framework and can run multiple queries in one database trip.