Skip to content

UseProjection over-projects every column when the EF entity is a record #9886

@drapka

Description

@drapka

Product

Hot Chocolate

Version

16.1.3

Link to minimal reproduction

https://github.com/drapka/hc-v16-projection-bug/blob/main/repro.cs

Steps to reproduce

  • Clone the repro repository
  • Run dotnet repro.cs from the project root

What is expected?

UseProjection translates the GraphQL selection set into the EF projection.
The query { classBlogs { id } } or { recordBlogs { id } } selects only id, so EF should emit:

SELECT b."Id" FROM "ClassBlogs" AS b

The shape of the C# DTO (class vs record) should not affect which columns are projected - only the GraphQL selection set should.

What is actually happening?

When the DTO is a record, UseProjection ignores the selection set and projects every mapped column. Same schema, same query, same property shape.

Relevant log output

CLASS  (expected: only Id)
  SELECT c."Id"

RECORD (bug: every column)
  SELECT r."Id", r."Description", r."Name"

Additional context

Regression likely introduced by #9199

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions