dotnet / dotnet/EntityFramework.Docs

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

Open
#3,341 1 comment 0 reactions 0 assignees View on GitHub
area-change-tracking area-save-changes
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

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.*

* ID: 0f0fb981-4dec-7ff7-817b-6606f620b875
* Version Independent ID: c7517e7d-f011-a24c-53da-913771913998
* Content: [Saving Related Data - EF Core](https://docs.microsoft.com/en-us/ef/core/saving/related-data)
* Content Source: [entity-framework/core/saving/related-data.md](https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/saving/related-data.md)
* Product: **entity-framework**
* Technology: **entity-framework-core**
* GitHub Login: @ajcvickers
* Microsoft Alias: **avickers**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.