dotnet / dotnet/EntityFramework.Docs
Include on related entities not required to add one as docs imply
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
> In the following example, the post entity is inserted because it is added to the Posts property of the blog entity which was fetched from the database.
That seems to imply that you're required to `Include` the related Posts to be able to add one, which concerned me quite a bit in a migration from ef 6 to core; but I just tried it out (ef core 6) and it seems to still add the related record even without eagerly loading the Posts.
That's a huge sigh of relief for obvious reasons. Is the doc incorrect? I can PR an update if you'd like.
---
#### 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
Assessment
This issue has not been assessed yet.