dotnet / dotnet/EntityFramework.Docs
Saving a graph of entities doesn't work for depth greater than 1
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
### Type of issue
Code doesn't work
### Description
I am trying to save a graph just like in the example shown. But there are multiple issues with the example:
- whatever I do, it throws an error when saving the `Post`, because the executed `INSERT` has still `BlogId=0`
- providing the Blog to the Post didn't help
- using Sync/Async processing didn't change anything
- the Post has many objects that are expected to be not null, yet aren't required to be set in constructor - this generates compilator warnings
### Page URL
https://learn.microsoft.com/en-us/ef/core/saving/related-data#adding-a-graph-of-new-entities
### Content source URL
https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/saving/related-data.md
### Document Version Independent Id
c7517e7d-f011-a24c-53da-913771913998
### Article author
@ajcvickers
Contributor guide
Assessment
This issue has not been assessed yet.