Skip to content
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

I believe it's worth mentioning EF is capable of detecting replacements of owned entities. #4981

Open
voroninp opened this issue Mar 14, 2025 · 0 comments

Comments

@voroninp
Copy link

Type of issue

Missing information

Description

If an instance of an owned entity is replaced with a new instance that has the same primary key, EF will detect the replacement and issue an update.

In contrast, if this were a regular navigation property, EF would raise an error, indicating an attempt to track multiple entities with the same identifier.

This highlights a significant difference in behavior between HasOne/HasMany and OwnsOne/OwnsMany.

Page URL

https://learn.microsoft.com/en-us/ef/core/modeling/owned-entities

Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/modeling/owned-entities.md

Document Version Independent Id

e3effbd0-07f2-423d-4032-1722e75adb37

Article author

@AndriySvyryd

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

No branches or pull requests

1 participant