dotnet / dotnet/EntityFramework.Docs

Documentation on setting state to EntityState.Detached and references

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

Description

Greatings happy holidays!

I was looking at this documentation for "EF Core".
There seems to be no documentation on "if the entity being detached has references"
when setting

```
MyContext.Entry(blog).State = EntityState.Detached;
```

I did a test on EF Core 5. Looks like all references gets detached also. Should I think of it that way?

---
#### Document Details

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

* ID: 130521ba-2943-c640-4190-7e22af37e154
* Version Independent ID: c31908e9-2836-8efd-5df6-e9dc5b5a9a5f
* Content: [Working with entity states - EF6](https://docs.microsoft.com/en-us/ef/ef6/saving/change-tracking/entity-state)
* Content Source: [entity-framework/ef6/saving/change-tracking/entity-state.md](https://github.com/dotnet/EntityFramework.Docs/blob/master/entity-framework/ef6/saving/change-tracking/entity-state.md)
* Product: **entity-framework**
* Technology: **entity-framework-6**
* 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.