I saw a ADO.NET EF and LINQ pagging structure like this:
var query = ...your normal query here...
int totalRecordCount = query.Count();
var pagedQuery = query.Skip(PageIndex*PageSize).Take(PageSize);
This code seems to query all records setting them into the local memory, so it gets the total count. After that, it pages de recording using the skip function into the variable pagedQuery. Am I wrong? How the comipile translate that to SQL? Is the another what to do that?
If the object you are querying implements
IQueryable<T>it will build a different query depending on the Extension methods you use. (Which it must be if you are using Linq-to-Entities)However logging the SQL is not as simple as with Linq-to-SQL.
Either use a profiler, or try adding this Extension method to a static class in your project:
With it you should be able to verify the SQL that is created by the different queries.