Kros-sk / Kros.Libs

This repo contains Kros.Utils, Kros.Utils.MsAccess, Kros.KORM and Kros.KORM.MsAccess libraries.
MIT License
7 stars 13 forks source link

Support for translate LINQ Skip method to SQL #91

Closed Burgyn closed 6 years ago

Burgyn commented 6 years ago

Breaking Changes

Description

Linq method Take is actualy translated into SQL. But method Skip isn't. Please support Skip method.

Common scenario:

using(var database = new Database("connection string ...", SqlServerDataHelper.ClientId)
{
  var people = database.Query<Person>().OrderBy(p=> p.Id).Skip(10).Take(10)
}

to be translated into:

SELECT Id, FirstName, ... FROM Person ORDER BY Id OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY

This syntax is available only in Ms SQL, so exception on MsAccess should be thrown.

Notes

satano commented 6 years ago

I am not sure if it can be implemented in LINQ, but why to throw exception on MS Access? We can enumerate through result set and skip rows manually.