dotnet / EntityFramework.Docs

Documentation for Entity Framework Core and Entity Framework 6
https://docs.microsoft.com/ef/
Creative Commons Attribution 4.0 International
1.63k stars 1.96k forks source link

Clarify: ICollection<T>.Remove(T) vs. EntityFrameworkCore.DbSet<T>.Remove(T) #3341

Open ianw1223 opened 3 years ago

ianw1223 commented 3 years ago

In the "Removing Relationships" I suggest clarifying ICollection.Remove(T) vs. EntityFrameworkCore.DbSet.Remove(T).

Note that there is no "Deleting Data" section in this docs section, since deletions happen when saving - but shouldn't the docs first advise the reader that to delete, they most likely should use DbSet.Remove(T) rather than deleting the relationship - which has its own big section? This is likely to be important to anyone who reverse engineered from a database without cascade delete configured for required FK relationships.

Thanks!

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ajcvickers commented 3 years ago

Note for triage: The change tracking docs have a lot more in-depth discussion of these concepts. We should probably either consolidate in one place, or at least link more explicitly.