【发布时间】:2016-09-15 00:50:54
【问题描述】:
在我的最新问题中,有人指出 DbSet.Local 会自动执行检测更改 看问题:Why is referencing DbSet.Local slow in a loop?
在 answers-cmets 中,此链接发布在 https://msdn.microsoft.com/en-us/data/jj556205.aspx 中,其中列出了属性
默认情况下,实体框架会自动执行检测更改 当调用以下方法时:
- DbSet.Find
- DbSet.Local
- DbSet.Remove
- DbSet.Add
- DbSet.Attach
- DbContext.SaveChanges
- DbContext.GetValidationErrors
- DbContext.Entry
- DbChangeTracker.Entries
列表中有两个属性我不确定为什么需要检测更改:find 和 local 我想可能需要它,因为可以有更多的 DbSet 实例,否则更改不会同步。
在 find 和 local 时检测变化的目的是什么?
【问题讨论】:
-
检查 cmets 是否有 blog.oneunicorn.com/2012/03/11/…
标签: c# entity-framework