Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[FeatureRequest] RowNumber overload without RowNumberOrderByClause #13

Open
Liero opened this issue Nov 5, 2021 · 1 comment
Open

Comments

@Liero
Copy link

Liero commented Nov 5, 2021

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
Copy link
Owner

PawelGerr commented Nov 12, 2021

Hi, the last idea (Select((entity, index) => )) looks interessting but currently I have no time to implement this feature.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants