[FeatureRequest] RowNumber overload without RowNumberOrderByClause
Liero opened this issue · 1 comments
Liero commented
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:
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 });
PawelGerr commented
Hi, the last idea (Select((entity, index) => )
) looks interessting but currently I have no time to implement this feature.