Translate Select() with index using the ROW_NUMBER() window function

Open
#24,218 3 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
database

Research direction

Start by examining EF Core's LINQ query translation for IQueryable.Select overloads that receive an index, then compare the requested ROW_NUMBER() SQL shape with the proposed client-side and SQL CASE alternatives. Done would require a decided translation behavior and coverage for the relevant query forms and providers.

Written by the indexing model from the issue text.

Description

area-query customer-reported

Integrated with EF entities mapping from database based on row number

There is a simply way to translate IQueryable.Select((source, index) => ... ) into SQL using row_number() over ()
And optional actions based on query: SQL case operator or client side transformation.

Just an example

select * [, case when t1."ROW" = ... then ... end]
from (
	select *, row_number() over () as "ROW"
	from ... t0
	where ...
	order by t0."DATE" desc
	limit ...
) t1
Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.