Using Row_Number in Linq where clause

how can i simulate the following sql query using linq. I just want to have a Row_Number column and use it in the linq where expression.

With t As (
    Select Row_Number() over ( Order by Id ) as 'RowId', * From Orders
) 
Select * From t Where RowId between 1 and 10
+1
source share
1 answer

I think that you are trying to do this simply by Skip / Take, for paging.

So basically:

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

(The code is untested, decommissioned from my head)

+1
source

All Articles