INotifyPropertyChanging

INotifyPropertyChanging

本文介绍了除了LINQ到SQL没有别的消费INotifyPropertyChanging?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从未使用过 INotifyPropertyChanging 我想知道如果有什么比LINQ to SQL的其他用途呢?

Having never used INotifyPropertyChanging i was wondering if anything other than Linq to SQL uses it?

如果LINQ到SQL是唯一的用户为什么 INotifyPropertyChanging 存在System.ComponentModel?

And if Linq to SQL is the only user why does INotifyPropertyChanging exist in System.ComponentModel?

推荐答案

据反射;)INotifyPropertyChanging用于LINQ to SQL和它的第三方类似物(如Devart.Data.Linq)来优化实体变化跟踪(延缓实体快照,直到第一个变化)。

According to Reflector ;) INotifyPropertyChanging is used in Linq to SQL and its third party analogs (like Devart.Data.Linq) to optimize entity change tracking (delaying entity snapshot till first change).

基本上,如果你载入X,对象,所属的DataContext将创建这些对象(快照)第X份,如果他们不执行INotifyPropertyChanging。

Basically, if you load X objects, the owning DataContext will create X copies of those objects (snapshots), if they don't implement INotifyPropertyChanging.

通过实施INotifyPropertyChanging,只有X PropertyChangingEventHandlers将被创建。但是,一旦作为第一个改变是,DataContext的开始克隆。

With implemented INotifyPropertyChanging, only X PropertyChangingEventHandlers will be created. But as soon, as first change comes, DataContext starts cloning.

因此​​,要实现INotifyPropertyChanging才有意义,那么,当你的类的数据实体的DataContext(LINQ到SQL),在大量的加载和主要用于读操作。

So, to implement INotifyPropertyChanging makes sense only then, when your classes are data entities in DataContext (Linq to Sql), loaded in massive amounts and mostly for read operation.

我也想看看在你的织女项目可选支持INotifyPropertyChanging的;)

I would also like to see optional support of INotifyPropertyChanging in your Weaver project ;)

这篇关于除了LINQ到SQL没有别的消费INotifyPropertyChanging?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:32