dotnet / dotnet/EntityFramework.Docs
Paragraph for optional relationship without dependent loaded makes no sense
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
Hi
According to the last table on the page, `ClientSetNull` throws an exception, but according to the text right below, `ClientSetNull` is the default. How does it make sense to have a default value that results in exceptions being thrown? I don't know if the table or the text is wrong, but surely the default results in the FK to be set to null somehow 💯
Also the notes disagree with itself:
> Notes:
> - Severing a relationship is not valid here since the dependents/children are not loaded.
> - The default for optional relationships like this is ClientSetNull.
> - Dependents/children must be loaded to avoid a database exception unless the database has been configured to cascade either deletes or nulls.
Point 1 says dependents must be loaded while point 3 says configuring cascading is okay even when dependents is not loaded?
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: 3ed1b8a1-fa32-e147-ae0f-76b3620473f9
* Version Independent ID: 10ce2d9f-8284-a509-5fed-669abfb9d8ae
* Content: [Cascade Delete - EF Core](https://learn.microsoft.com/en-us/ef/core/saving/cascade-delete)
* Content Source: [entity-framework/core/saving/cascade-delete.md](https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/saving/cascade-delete.md)
* Product: **entity-framework**
* Technology: **entity-framework-core**
* GitHub Login: @ajcvickers
* Microsoft Alias: **avickers**
Contributor guide
Assessment
This issue has not been assessed yet.