如何举办物业变更活动? [英] How to raise an event on Property Change?

查看:95
本文介绍了如何举办物业变更活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用DataSet时,可能会在RowChanging,RowChanged,ColumnChanging,ColumnChanged等中引发事件。

When I use DataSet, there is possiblity to raise events on RowChanging, RowChanged, ColumnChanging, ColumnChanged, etc...

如何使用实体实体框架?

How to do the same with an entity from Entity Framework ?

推荐答案

实体已经实现了 PropertyChanged 事件,因为它们实现 System.ComponentModel.INotifyPropertyChanged 。如果你想捕捉到你的entieis的变化,你可以订阅。

Entities already implement the PropertyChanged event since they implement System.ComponentModel.INotifyPropertyChanged. If you want to catch changes to your entieis, you can just subscribe to that.

另外请注意,实体支持以下两种部分方法 - 其中第二种应该给你相当于RowChanging - 如果您想要回复您的课程中的更改,您可以覆盖:

Also note that entities support the following two partial methods—the second of which should give you the equivalent of "RowChanging"—that you can override if you'd like to respond to changes within your class:

protected override void OnPropertyChanged(string property) {}

protected override void OnPropertyChanging(string property) {}

这篇关于如何举办物业变更活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆