It is not possible to test with the Entity Framework at the moment, but regular LINQ-to-SQL allows the following statements:
var rpage1 = entities.GetSearchData(null,"en",null,true).Skip(0).Take(10) var rpage2 = entities.GetSearchData(null,"en",null,true).Skip(10).Take(10) var rlist = rpage1.ToList();
LINQ will generate a sentence like
WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1
In my case, the resulting query was (GetConstantsValues - stored procedure):
SELECT [t1].[value] AS [Value] FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [t0].[value]) AS [ROW_NUMBER], [t0].[value] FROM [dbo].[GetConstantsValues](@p0) AS [t0] ) AS [t1] WHERE [t1].[ROW_NUMBER] BETWEEN @p1 + 1 AND @p1 + @p2 ORDER BY [t1].[ROW_NUMBER]
Thus, only relevant results are loaded into the program.
I believe that EF should not be very different from it. Perhaps wrong.
source share