Skip to content

Conversation

@AndriySvyryd
Copy link
Member

@AndriySvyryd AndriySvyryd commented Aug 7, 2025

Fix value type complex properties in the model snapshot

Fixes #36494
Part of #31237

@AndriySvyryd AndriySvyryd requested a review from Copilot August 7, 2025 01:12
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner August 7, 2025 01:12
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

This PR enhances Entity Framework Core's model snapshot generation to properly handle complex properties, including value type complex properties and complex collections. The changes ensure that complex property configurations are correctly serialized and deserialized in migration snapshots.

Key changes:

  • Fixed snapshot generation for value type complex properties using typeof() instead of generic syntax
  • Added missing extension methods for ComplexCollectionTypePropertyBuilder to support relational database configurations
  • Updated test cases to verify proper handling of complex properties in snapshots

Reviewed Changes

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

File Description
test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs Updated test cases to verify complex property snapshot generation, including value type structs and JSON mapping scenarios
src/EFCore.Relational/Extensions/RelationalComplexCollectionTypePropertyBuilderExtensions.cs Added comprehensive extension methods for configuring complex collection properties in relational databases
src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs Fixed snapshot generation logic to handle complex collections and value types correctly using typeof() syntax
Comments suppressed due to low confidence (1)

Fix value type complex properties in the model snapshot
Add missing extension methods for ComplexCollectionTypePropertyBuilder

Fixes #36494
Part of #31237
@AndriySvyryd AndriySvyryd enabled auto-merge (squash) August 7, 2025 18:38
@AndriySvyryd AndriySvyryd merged commit bf360db into main Aug 7, 2025
7 checks passed
@AndriySvyryd AndriySvyryd deleted the Issue36494 branch August 7, 2025 19:24
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.

ComplexProperty creates a migration loop after upgrading from 9.0.7 to 10.0.0-preview.6.25358.103

2 participants