[英]Why DbSet.Local performs Detect Changes automatically?
In my latest question it was pointed out that DbSet.Local automatically performs Detect Changes See the question: Why is referencing DbSet.Local slow in a loop? 在我的最新问题中,有人指出DbSet.Local自动执行检测更改。请参阅问题: 为什么在循环中引用DbSet.Local的速度很慢?
In the answers-comments this link was posted https://msdn.microsoft.com/en-us/data/jj556205.aspx which lists the properties 在答案注释中,此链接发布于https://msdn.microsoft.com/en-us/data/jj556205.aspx ,其中列出了属性
By default, the Entity Framework performs Detect Changes automatically when the following methods are called:
默认情况下,当调用以下方法时,实体框架会自动执行“检测更改”:
- DbSet.Find
数据库设置
- DbSet.Local
DbSet.Local
- DbSet.Remove
DbSet。删除
- DbSet.Add
DbSet.Add
- DbSet.Attach
DbSet。附加
- DbContext.SaveChanges
DbContext.SaveChanges
- DbContext.GetValidationErrors
DbContext.GetValidationErrors
- DbContext.Entry
DbContext.Entry
- DbChangeTracker.Entries
DbChangeTracker.Entries
There are two properties in the list which I'm not sure why detect changes is necessary: find and local I guess it might be needed as there can be more instances of DbSet and changes would not get synced otherwise. 列表中有两个属性,我不确定为什么要检测到更改是必需的:find和local我猜可能是必需的,因为可能会有更多的DbSet实例,否则更改将不会同步。
What's the purpose of detect changes upon find and local? 发现和本地发现变化的目的是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.