1

I am using EF 6.0.0 in C# ASP.net MVC 4. When I use Take(10) and Skip(30) in linq, in sql profiler I can see it as TOP 10 and "> 30" in where clause. How to write linq such that I get

OFFSET 30 ROWS
FETCH NEXT 10 ROWS ONLY

Thanks.

Nands
  • 379
  • 3
  • 19

1 Answers1

2

Did you try to do something like this?

int skipRecords = 30;
int takeRecords = 10;
context.SomeEntities.Skip(() => skipRecords)
    .Take(() => takeRecords)
    .ToList();

If you use variables, sql query will be parameterized.

zholinho
  • 460
  • 1
  • 5
  • 17