GridView - How to manually update EntityDataSource?
I have a GridView bound to an EntityDataSource. Automatic Updates/Inserts/Deletes are enabled, and these operations function correctly.
However, I'd like to make multiple edits before commiting anything to the database. (vs. committing each row as soon as the Update button is clicked.) When the user finally clicks a Save button, all the page's edits shall be committed.
e.g. myEntityModel.Sav开发者_JAVA技巧eChanges();
This link says to copy the data to a new table and bind the GridView to that. Would that be the recommended approach for Entity Framework (4.0), or is there a better way?
Thanks!
Yes, its right way to do that. look here for some interesting discussion on this topic. I mean calling savechanges at last, till that time modified entities will be persisted virtually.
note: Batch update is not currently done by EF, even you say save changes multiple queries will hit to database. There are other way around to achieve this.
精彩评论