-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix null complex property values in SaveChanges for table splitting #36467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 fixes an issue with null complex property values during SaveChanges when using table splitting by adding support for nullable struct complex properties. The main purpose is to properly handle nullable value types in complex property configurations and update tracking.
Key changes:
- Add complex property builder overloads that accept nullable struct expressions (
Expression<Func<TEntity, TProperty?>>) - Update complex type resolution to unwrap nullable types correctly
- Fix column modification logic to handle null complex properties in table splitting scenarios
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/EFCore/Metadata/Internal/InternalTypeBaseBuilder.cs |
Updates complex type resolution to unwrap nullable types using UnwrapNullableType() |
src/EFCore/Metadata/Builders/EntityTypeBuilder*.cs |
Adds overloaded methods for nullable struct complex properties and collections |
src/EFCore/Metadata/Builders/ComplexPropertyBuilder*.cs |
Adds overloaded methods for nullable struct complex properties within complex types |
src/EFCore/Metadata/Builders/ComplexCollectionBuilder*.cs |
Adds overloaded methods for nullable struct complex collections within complex types |
src/EFCore.Relational/Update/ColumnModification.cs |
Updates GetCurrentValue to handle null complex properties in table splitting |
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs |
Updates tests to use nullable License properties and adds new test cases |
| Various test files | Refactors test inheritance to use relational base classes and removes nullable disable pragmas |
Comments suppressed due to low confidence (1)
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Specification.Tests/ComplexTypesTrackingTestBase.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Relational.Specification.Tests/ComplexTypesTrackingSqlServerTest.cs
Show resolved
Hide resolved
|
FYI, the failures are from InMemory. |
Fix null complex property values in SaveChanges for table splitting Part of #31376
4d3aca4 to
29229ef
Compare
Add complex property builder overloads for nullable structs
Part of #31376
cc @artl93