Skip to content

Fix duplicate joins when materializing writable projectables with includes#218

Open
PhenX wants to merge 1 commit into
masterfrom
claude/github-issue-217-9odp2y
Open

Fix duplicate joins when materializing writable projectables with includes#218
PhenX wants to merge 1 commit into
masterfrom
claude/github-issue-217-9odp2y

Conversation

@PhenX

@PhenX PhenX commented Jul 14, 2026

Copy link
Copy Markdown
Member

A writable [Projectable] property triggers a whole-entity re-projection so
the property can be populated during materialization. That re-projection read
every other mapped member through its compiler-generated backing field
(what EF's member metadata resolves auto-properties to). Reading a mapped
scalar or navigation through the backing field stops EF's navigation
expansion from recognizing it as a plain column/navigation, so EF instead
materializes the entire source entity -- including any Include-ed collection
navigation -- once per rewritten member, emitting one duplicate JOIN per
member (issue #217).

Read each member through its CLR property instead, and bind to the property
when it is settable so the projection keeps natural column names. EF then
treats scalars as columns and collapses the collection navigation into a
single join.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_016Xvb9UMRqFJKpocKCCeYcc

…ludes

A writable [Projectable] property triggers a whole-entity re-projection so
the property can be populated during materialization. That re-projection read
every other mapped member through its compiler-generated backing field
(what EF's member metadata resolves auto-properties to). Reading a mapped
scalar or navigation through the backing field stops EF's navigation
expansion from recognizing it as a plain column/navigation, so EF instead
materializes the entire source entity -- including any Include-ed collection
navigation -- once per rewritten member, emitting one duplicate JOIN per
member (issue #217).

Read each member through its CLR property instead, and bind to the property
when it is settable so the projection keeps natural column names. EF then
treats scalars as columns and collapses the collection navigation into a
single join.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Xvb9UMRqFJKpocKCCeYcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants