简体   繁体   English

带有LINQ的DataGridView快速自动保存更改

[英]DataGridView with LINQ fast autosave changes

I'm use DataGridView with LINQ BindingSource. 我将DataGridView与LINQ BindingSource一起使用。 And I need autosave changes after adding, editing or deleting rows by: 我需要通过以下方式添加,编辑或删除行后自动保存更改:

dataContext.SubmitChanges(); dataContext.SubmitChanges();

Now I'm use AddedRow, DeletedRow, ValueChanged events, but when user delete 1000 rows, this causes 1000 calls of "dataContext.SubmitChanges();" 现在,我使用AddedRow,DeletedRow,ValueChanged事件,但是当用户删除1000行时,这将导致对“ dataContext.SubmitChanges();”的1000次调用。 and this is very slow. 这很慢。

How i can call "dataContext.SubmitChanges();" 我如何调用“ dataContext.SubmitChanges();” one time after adding, deleting or editing all rows? 添加,删除或编辑所有行后一次?

看起来您可以使用bindingSource的List_Changed事件,如此处所述: 使用bindingsource拥有busniess对象

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM