Skip to content

Conversation

PHILLIPS71
Copy link
Contributor

Summary

Fixes an issue where ParentRequires functionality was not working when using EF Core projections. Required parent properties were not being included in the generated EF Core queries, causing computed properties to incorrectly resolvers if parent data wasn't also referenced in the query.

Problem

The ParentRequires feature worked correctly with the built-in SelectionExpressionBuilder but failed when using EF Core projections through UseProjection(). This happened because:

  • SelectionExpressionBuilder processes field requirements and includes them in projections
  • QueryableProjectionVisitor (used by EF Core projections) did not have any logic to handle field requirements
  • Required parent properties were never added to the EF Core query, leaving resolvers without access to the necessary data

Solution

Added field requirements processing to QueryableProjectionVisitor following the same pattern as SelectionExpressionBuilder

Changes Made

Core Implementation

  • QueryableProjectionVisitor.cs: added requirements processing logic following SelectionExpressionBuilder patterns

Tests

  • IntegrationTests.cs: added tests for both string-based and expression-based ParentRequires scenarios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant