Repository navigation
Add IsProjected support to selector-based projections - #10290
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns selector-based projections (e.g., QueryContext<T> and DataLoader Select(selection)) with projection middleware behavior by honoring IsProjected() / [IsProjected] for both always-projected and never-projected fields, and it replaces the removed public ProjectionFeature record with internal CoreFieldFlags-based state.
Changes:
- Honor
AlwaysProjectedandNotProjectedwhen building projections from selection sets (including__typename-only selections) and when using DataLoader selector paths. - Remove
HotChocolate.Data.Projections.ProjectionFeatureand move its state to internalCoreFieldFlags(AlwaysProjected,NotProjected,HasProjectionMiddleware) plus an internal helper onIOutputFieldDefinition. - Add EF Core Sqlite tests that snapshot the generated SQL to verify always/never projection behavior for selector-based projections.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/content/docs/hotchocolate/migrating/migrate-from-15-to-16.md | Documents the breaking removal of ProjectionFeature and directs users to IsProjected() / [IsProjected]. |
| src/HotChocolate/Data/test/Data.EntityFramework.Tests/IsProjectedSelectorTests.cs | Adds SQL-snapshot integration tests for selector-based IsProjected behavior (QueryContext + DataLoader Select(selection)). |
| src/HotChocolate/Data/src/Data/Projections/ProjectionTypeInterceptor.cs | Switches always-projected field detection to internal core flags. |
| src/HotChocolate/Data/src/Data/Projections/ProjectionFeature.cs | Removes the public ProjectionFeature record (breaking API change). |
| src/HotChocolate/Data/src/Data/Projections/Extensions/ProjectionObjectFieldDescriptorExtensions.cs | Writes projection behavior into CoreFieldFlags and sets HasProjectionMiddleware when compiling projection middleware. |
| src/HotChocolate/Data/src/Data/Projections/Extensions/OutputFieldExtensions.cs | Reads projection behavior (NotProjected, AlwaysProjected, HasProjectionMiddleware) from core flags instead of Features. |
| src/HotChocolate/Core/src/Types/Types/Extensions/OutputFieldDefinitionExtensions.cs | Adds internal helper to read CoreFieldFlags from IOutputFieldDefinition implementations. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/CoreFieldFlags.cs | Introduces new internal flags used to represent projection state. |
| src/HotChocolate/Core/src/Execution.Projections/SelectionExpressionBuilder.cs | Skips NotProjected fields and injects AlwaysProjected leaf-property fields into selector-based projections. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Patch coverage100.0% of changed lines covered (34/34)
Project coverage: 57.5% (283887/493502 lines) |
michaelstaib
approved these changes
Aug 28, 2026
This was referenced Aug 29, 2026
Merged
This was referenced Sep 8, 2026
Closed
Closed
This was referenced Sep 15, 2026
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#405
Closed
Closed
This was referenced Sep 22, 2026
Closed
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#410
Merged
This was referenced Oct 5, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IsProjected()and[IsProjected]are now honored when projections are built from the selection set throughQueryContext<T>or a DataLoaderSelect(selection)call, matching the projection middleware: always-projected leaf fields backed by a property are fetched even when not selected, and never-projected fields are skipped even when selected (resolving to their default value).HotChocolate.Data.Projections.ProjectionFeaturerecord is removed. Its state is now carried by internalCoreFieldFlags(AlwaysProjected,NotProjected,HasProjectionMiddleware), read through a new internal helper onIOutputFieldDefinition.HasProjectionMiddlewaregets its own flag instead of reusingUsesProjections, which[SkipDataLoaderCache]also sets.Test plan
IsProjectedSelectorTests(Sqlite with SQL capture) pin the exact SQL: always-projected fetched when unselected, never-projected omitted when selected,__typename-only selection, and the DataLoaderSelect(selection)path.Closes #8313