Skip to content

Address review comments for partial property loading#37882

Open
roji wants to merge 2 commits intodotnet:mainfrom
roji:fix-partial-loading-review-comments
Open

Address review comments for partial property loading#37882
roji wants to merge 2 commits intodotnet:mainfrom
roji:fix-partial-loading-review-comments

Conversation

@roji
Copy link
Member

@roji roji commented Mar 7, 2026

Addresses the unresolved review comments from #37857:

  1. Moved constructor-binding validation from ValidateConstructorBindingAutoLoaded into ValidateAutoLoaded, since non-autoloaded properties are rare and the check should only run when one is encountered.
  2. Simplified IsAutoLoaded filter in StructuralTypeMaterializerSource by moving Where() before Cast<IPropertyBase>() for cleaner direct property access.

Move constructor-binding validation from ValidateConstructorBindingAutoLoaded
into ValidateAutoLoaded, since non-autoloaded properties are rare and the
check should only run when one is encountered.

Simplify IsAutoLoaded filter in StructuralTypeMaterializerSource by moving
Where() before Cast<IPropertyBase>().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 7, 2026 08:38
@roji roji requested a review from a team as a code owner March 7, 2026 08:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses follow-up review feedback for the “partial property loading” work by tightening when auto-load validation runs and simplifying an auto-load filter in the materializer pipeline.

Changes:

  • Moved constructor-binding vs. “not auto-loaded” validation to run only when encountering a property configured as not auto-loaded.
  • Simplified StructuralTypeMaterializerSource property filtering by applying Where() before Cast<IPropertyBase>().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/EFCore/Query/Internal/StructuralTypeMaterializerSource.cs Simplifies the property filter for materialization to use direct IProperty access before casting.
src/EFCore/Infrastructure/ModelValidator.cs Refactors auto-load validation to incorporate constructor-binding validation in ValidateAutoLoaded instead of a separate per-type pass.

You can also share your feedback on Copilot code review. Take the survey.

- Check constructor bindings across derived types, not just the declaring type
- Update XML doc summary to mention constructor bindings
- Add regression test for derived type constructor consuming base property

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roji roji enabled auto-merge (squash) March 7, 2026 09:02
@roji roji disabled auto-merge March 7, 2026 09:02
@roji roji enabled auto-merge (squash) March 7, 2026 09:02
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.

3 participants