开发者

C#: BindingSource CancelEdit for all objects and there child objects from EF

开发者 https://www.devze.com 2023-04-06 12:06 出处:网络
Let\'s say i have two objects from EF with INotifyPropertyChanged. Object1 has many Object2 and the BindingSource1 has many Object1.

Let's say i have two objects from EF with INotifyPropertyChanged.

Object1 has many Object2 and the BindingSource1 has many Object1.

If I change some Properties of BindingSource1.Current (Object1) I'm able to restore them by calling BindigSource1.CancelEdit, before the BindingSource1.Current (Object1) has changed.

But if I create a BindingSource2 for the Objects2 in the BindingSource1.Current (Object1) and change Properties in BindingSource2(Object2), I can't restore them by calling BindigSource1.CancelEdit.

In my case I have BindingSource1 bind to DataGridView1 and Bindi开发者_开发技巧ngSource2 to DataGridView2. Now I want so Retore Object1 and all its Object2 if the user selects an other Object1 in DataGridView1 without clicking Save.

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号