OrderBy with Skip and Take
Posted: Tue 17 Feb 2015 20:49
I am using the most recent version of dotConnect for Salesforce 2.4.573.
and EntityFramework 6.1.1
When I issue the following query the orderby is omitted from the SQL command.
I am setting an interceptor in web.config:
The resulting SQL command omits the ORDER BY
The same code works correctly with SQL Server generating SQL with
I see that something like this has been reported and fixed in the past:
http://forums.devart.com/viewtopic.php? ... kip#p46524
Any help with this is greatly appreciated.
and EntityFramework 6.1.1
When I issue the following query the orderby is omitted from the SQL command.
Code: Select all
IQueryable<Account> accounts = _context.Accounts.Where(a => a.Type == "SomeType")
accounts = accounts.OrderBy("Name", "asc", true).Skip(50).Take(25);
List<Account> testList = accounts.ToList();Code: Select all
<interceptor type="System.Data.Entity.Infrastructure.Interception.DatabaseLogger, EntityFramework">If I omit the Skip() then the ORDER By is included.SELECT Extent1.Id AS Id, Extent1.Name as Name... FROM Account AS Extent1 WHERE 'SomeType' = Extent1.Type LIMIT 25 OFFSET 50
The same code works correctly with SQL Server generating SQL with
The use of skip and take are incredibly important for server side pagination.SELECT TOP (25) [Extent1].[Id] AS [Id], [Extent1].[Name] AS [Name]...
WHERE [Extent1].[row_number] > 50
ORDER BY [Extent1].[Name] ASC
I see that something like this has been reported and fixed in the past:
http://forums.devart.com/viewtopic.php? ... kip#p46524
Any help with this is greatly appreciated.