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
modelBuilder.Entity<Customer>().OwnsMany(
order =>order.Addresses, ownedNavigationBuilder =>{ownedNavigationBuilder.ToJson();});
We then query the previously added document, and, after updating it, we are unable to save the changes in the database because of an unknown shadow key property in the list of complex objects.
We have tried to set the state of the object and of the elements in the list to Modified but found no difference:
The value of shadow key property 'Address.Id' is unknown when attempting to save changes.
This is because shadow property values cannot be preserved when the entity is not being tracked.
Consider adding the property to the entity's .NET type.
See https://aka.ms/efcore-docs-owned-collections for more information.
Provider and version information
EF Core version: 8.0.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.11.0
The text was updated successfully, but these errors were encountered:
Issue
We enabled the
NoTracking
query behavior on a Entity Framework DB Context.Our setup heavily relies on entity tracking being disabled:
We then add successfully a new row containing a column with a JSON document with a list of a complex type:
Using the
ToJson
model builder:We then query the previously added document, and, after updating it, we are unable to save the changes in the database because of an unknown shadow key property in the list of complex objects.
We have tried to set the state of the object and of the elements in the list to
Modified
but found no difference:Code
I created a simple project to replicate the issue:
https://github.com/Sticcia/EFCore8Test
Stack Trace
Provider and version information
EF Core version: 8.0.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.11.0
The text was updated successfully, but these errors were encountered: