Repository navigation
Fix repeated seed-data updates for list properties - #4024
Merged
Merged
Conversation
Use the collection value comparer for key comparisons and adapt it to the collection CLR type. Add regression coverage for unchanged and modified lists and arrays. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 3c4821db-381a-4b52-8547-0bb8ea084cb0
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Reusing the value comparer introduces inconsistent hashing for content-equal binary-array keys, which can break identity-map lookups.
1 open issue
What changed in this PR
Addresses #3635 by using element-wise collection comparison to avoid redundant seed-data updates in migrations.
Changes:
- Adapts the collection comparer to the mapped CLR type and reuses it for keys.
- Adds regression tests for unchanged and modified lists and arrays.
| File | Description |
|---|---|
| test/EFCore.PG.Tests/Migrations/NpgsqlMigrationsModelDifferTest.cs | Tests collection seed-data differences. |
| src/EFCore.PG/Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs | Updates collection comparer configuration. |
Review effort: Balanced
Construct collection key comparers from element key comparers rather than value comparers. Cover equal hashes for independently allocated binary arrays and lists. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 3c4821db-381a-4b52-8547-0bb8ea084cb0
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport source correction cd7d820 from #4024. Build the collection key comparer from the element key comparer and cover matching hashes for independently allocated binary arrays and lists. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c915897d-780d-411c-9e44-96717dd39e19
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport the #4024 correction: build collection key comparers from element key comparers, preserving structural equality and hashing for binary array/list elements. (cherry picked from commit cd7d820) Co-authored-by: Copilot App <[email protected]> Copilot-Session: 85e067fd-39b0-4a09-8247-395a5d886a3f
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
1 resolved since last review
Review effort: Lite
Copilot stopped reviewing on behalf of
roji due to an error
October 18, 2026 13:31
roji
added a commit
that referenced
this pull request
Oct 18, 2026
* [9.0] Fix repeated seed-data updates for list properties Backport #4024 (8fd6510). Reuse the element-wise collection comparer for key comparisons and retype its expressions to the mapped collection CLR type with the EF 9 comparer APIs. Preserve regression coverage for unchanged and modified lists and arrays. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c915897d-780d-411c-9e44-96717dd39e19 * [9.0] Preserve structural element hashing for collection keys Backport source correction cd7d820 from #4024. Build the collection key comparer from the element key comparer and cover matching hashes for independently allocated binary arrays and lists. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c915897d-780d-411c-9e44-96717dd39e19 --------- Co-authored-by: Copilot App <[email protected]> Copilot-Session: c915897d-780d-411c-9e44-96717dd39e19
roji
added a commit
that referenced
this pull request
Oct 18, 2026
* [8.0] Fix repeated seed-data updates for list properties Backport #4024. Reuse the collection value comparer for key comparisons and adapt its expressions to the collection CLR type using the EF 8 comparer APIs. Fixes #3635 (cherry picked from commit 8fd6510) Co-authored-by: Copilot App <[email protected]> Copilot-Session: 85e067fd-39b0-4a09-8247-395a5d886a3f * [8.0] Preserve structural element hashing for collection keys Backport the #4024 correction: build collection key comparers from element key comparers, preserving structural equality and hashing for binary array/list elements. (cherry picked from commit cd7d820) Co-authored-by: Copilot App <[email protected]> Copilot-Session: 85e067fd-39b0-4a09-8247-395a5d886a3f --------- Co-authored-by: Copilot App <[email protected]> Copilot-Session: 85e067fd-39b0-4a09-8247-395a5d886a3f
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.

Unchanged seeded
List<string>properties produce redundantUpdateDataoperations because migrations use the key/provider comparer rather than the element-wise value comparer.Construct element-wise collection key comparers from the element key comparer, adapting them to the collection CLR type. This also preserves structural hashing for binary-array keys. Add regression coverage for unchanged and modified lists and arrays, and equality/hash consistency for binary collections.
Fixes #3635