How to get rid of track id

broken image

It is not necessary to clear the change tracker or explicitly detach entity instances when taking this approach. Call SaveChanges to update the database.In other words, the lifetime of a DbContext should be: This means that disposing the DbContext is the normal way to stop tracking entities. The change tracker is cleared (EF Core 5.0 and later)ĭbContext is designed to represent a short-lived unit-of-work, as described in DbContext Initialization and Configuration.Detected as new entities connected to existing tracked entitiesĮntity instances are no longer tracked when:.Explicitly attached to the DbContext by Add, Attach, Update, or similar methods.Returned from a query executed against the database.How to track entitiesĮntity instances become tracked when they are: Calling and awaiting the async method can be substituted unless otherwise noted.

broken image
broken image

For simplicity, this document uses and references synchronous methods such as SaveChanges rather than their async equivalents such as SaveChangesAsync.