How do I add ROW_NUMBER to a LINQ query or Entity?
How can I convert this solution to VB.NET?
var start = page * rowsPerPage;
Products.OrderByDescending(u => u.Sales.Count())
.Skip(start)
.Take(rowsPerPage)
.AsEnumerable()
.Select((u, index) => new { Product = u, Index = index + start }); // this line gets me
I'm having trouble porting that last line. I have been unable to locate a VB.NET example.
I'm actually not looking for any paging functionality like the example provides, just good old-fashioned Row_Number(Order By X)
row index.
LinqToSql can't do a Row_Number(Order By X) in the database.
The c# code you posted does it against in-memory instances by calling Enumerable.Select
On the msdn page for Enumerable.Select, there's a vb.net example.
Here is a working example that demonstrates the projection of a row index in VB.NET: