EntityFramework.Docs
EntityFramework.Docs copied to clipboard
Depth of Values of SetValues()
When using SetValues(), does EF only detect changes to the top level entity or does it walk the graph for navigation properties as well?
For example if I have disconnected entity that has several populated navigation properties and use SetValues to set the differences to a connected entity, do I need to null out my navigation properties (leaving the navigation foreign key) to prevent SetValues from changing the navigation properties as well?
Jason
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: a5005a6d-6e1c-f275-caf1-4dd24f47f8eb
- Version Independent ID: 43a2935e-548f-3d72-2143-17c2b7165616
- Content: PropertyValues.SetValues Method (Microsoft.EntityFrameworkCore.ChangeTracking)
- Content Source: dotnet/xml/Microsoft.EntityFrameworkCore.ChangeTracking/PropertyValues.xml
- Product: ef-core-api
- GitHub Login: @dotnet-bot
- Microsoft Alias: divega
@zanate4019 SetValues will not set navigation properties. It acts on a single entity instance.