How to update a detached object with a collection inside on EF Core?

Detached object saves perfectly if I change most of the fields.. the issue is with a collection this object has. Changes on the collection are not persisted. I've seen the query executed and it onl touches the "main" table. All dependent relations are not updated

EF is not aware of the changed collection or about the navigation properties.By setting the State of the dbEntityEntry to EntityState.Modified, EF only knows that the object dbEntityEntry has been changed. This means that EF will only update dbEntityEntry but not it's navigation properties.

Solution :

You can iterate over all collection (or navigation properties) of the current dbEntityEntry and set the entity state to EntityState.Modified.