, ...
Repository.Find()
IList, , SQL ,
.Skip(x).Take(x)
executed in memory. Try
Repository.All().Where(expression).Skip(x).Take(x)
all of which return IQueryable and do not include an enumeration of objects, and therefore paging is performed in SQL using the ROW_NUMBER () function.
Having said that Subsonic 3 simple repository generates the following SQL
exec sp_executesql N'SELECT [t0].[Id], [t0].[IsDeleted], [t0].[Name], [t0].[ParentUuid], [t0].[Uuid]
FROM ( SELECT [t1].[Id], [t1].[IsDeleted], [t1].[Name], [t1].[ParentUuid], ROW_NUMBER() OVER() AS rownum, [t1].[Uuid]
FROM [Sites] AS t1
WHERE (([t1].[ParentUuid] = @p0) AND ([t1].[IsDeleted] = 0))) AS t0
WHERE [t0].[rownum] BETWEEN (20 + 1) AND (20 + 10)',N'@p0 uniqueidentifier',@p0='00000000-0000-0000-0000-000000000000'
which throws an exception
Unhandled Exception: System.Data.SqlClient.SqlException: The ranking function "ROW_NUMBER" must have an ORDER BY clause.
therefore, it would seem that there is an error in Subsonic: - (
source
share