You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When updating an existing owned type where originally all it's properties are null, the update is not detected by the ChangeTracker, but if a single column is assigned to a not-null value in the database, the update is executed as normally.
Steps to reproduce
Create an owned type where all of its properties can be null
INSERT a row with only null values and another with some non-null values
Updating the owned type property for the all-nulls rows doesn't do anything
The same code for the 2nd row with some non-null values does update
classMyTable{publicintIdMyTable{get;set;}publicMyOwnedTypeOwned{get;set;}=new MyOwnedType()}[Owned]classMyOwnedType{publicstringProp1{get;set;}publicstringProp2{get;set;}}varrow= c.MyTable.Where(x => x.IdMyTable ==1).First();//This is done on the database only if the original row has any non-null value in owned type related columns
row.Owned.Prop1 ="hello";//If we inspect the ChangeTracker, 2 entities are tracked for the row with non-nulls but only 1 with the all nulls row
c.SaveChanges();
Further technical details
EF Core version: 3.1.3
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.5.0
The text was updated successfully, but these errors were encountered:
When updating an existing owned type where originally all it's properties are null, the update is not detected by the ChangeTracker, but if a single column is assigned to a not-null value in the database, the update is executed as normally.
Steps to reproduce
Further technical details
EF Core version: 3.1.3
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.5.0
The text was updated successfully, but these errors were encountered: