How does SaveChangesAsync make call to the update method on the repository?
The DbContext is the repository, and it's tracking the oldCamp object. When SaveChagnes () is called it will detect changes to any tracked entities and take the appropriate action (insert,update or delete).
Under the hood SaveChangesAsync()
will automatically call DetectChanges()
to discover any changes to entity instances before saving to the underlying database. This can be disabled via AutoDetectChangesEnabled
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.