Open Liero opened 3 years ago
I want to add RowNumbers to IOrderedQueryable<TEntity>.
IOrderedQueryable<TEntity>
The problem is, that constructing RowNumberOrderByClause dynamically is not a trivial task.
I think following overload would be useful:
var query = dbContext.Products; var orderedQuery = ApplyOrderBy(query, DataGrid.SortModel); orderedQuery.Select(entity => new { entity, rowNumber = EF.Functions.RowNumber(entity) })
alternativelly:
RowNumberOrderByClause FromOrderedQueryable<TEntity>(IOrderedQueryable<TEntity> query); orderedQuery.Select(entity => new { entity, rowNumber = EF.Functions.RowNumber(RowNumberOrderByClause.FromOrderedQueryable(query)) })
Simmilar approach was mentioned here #7
EDIT:
or even better this Select overload:
orderedQuery.Select((entity, index) => new { entity, index });
Hi, the last idea (Select((entity, index) => )) looks interessting but currently I have no time to implement this feature.
Select((entity, index) => )
I want to add RowNumbers to
IOrderedQueryable<TEntity>
.The problem is, that constructing RowNumberOrderByClause dynamically is not a trivial task.
I think following overload would be useful:
alternativelly:
Simmilar approach was mentioned here #7
EDIT:
or even better this Select overload: