1

how can I simulate the following sql query using linq. I just want to have a Row_Number column and use it's values in linq where clause.

With t As (
    Select Row_Number() over ( Order by Id ) as 'RowId', * From Orders
) 
Select * From t Where RowId between 1 and 10
Mark Bell
  • 28,985
  • 26
  • 118
  • 145
Vahid Ghadiri
  • 3,966
  • 7
  • 36
  • 45

1 Answers1

1

I think what you're trying to do is just Skip/Take, for paging.

So basically:

var result = dataContext.Products.Skip(0).Take(10).ToList();

(Code is untested, written off the top of my head)

Phill
  • 18,398
  • 7
  • 62
  • 102