Skip to content

Only apply AsSplitQuery in VerifyEntity when a collection is included - #1092

Merged
SimonCropp merged 1 commit into
mainfrom
split-query-only-for-collections
Sep 28, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
split-query-only-for-collections

Conversation

@SimonCropp

Copy link
Copy Markdown
Owner

VerifyEntity always wrapped the set in AsSplitQuery(). Verify.EntityFramework 16 throws when AsSplitQuery() is used on a query that loads no collection, so every VerifyEntity<T>(id) without a collection Include failed:

AsSplitQuery() is ignored, since the query loads no collection.

QuerySplitting.SplitIfIncludesCollection walks the query's Include/ThenInclude calls and only applies AsSplitQuery() when one loads a collection (a string Include path is assumed to be a collection). It is shared by the MSTest, NUnit, TUnit and Xunit.V3 variants.

Queries that include collections still get split queries, so no snapshots change. A collection loaded only through AutoInclude is not detected.

VerifyEntity always wrapped the set in AsSplitQuery(). Verify.EntityFramework 16
throws for AsSplitQuery on a query that loads no collection, so every
VerifyEntity<T>(id) without a collection Include failed.

QuerySplitting.SplitIfIncludesCollection walks the query's Include/ThenInclude
calls and only splits when one loads a collection (or uses a string path).
Applied to the MSTest, NUnit, TUnit and Xunit.V3 variants.
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.

1 participant