Answer the question
In order to leave comments, you need to log in
How to pull out deleted, added and changed records from the dataGridView, which then need to be passed to NHibernate?
Good time of the day.
There is a simple Windows Forms application which works with a DB through NHibernate.
The data is loaded into the DataGridView with the possibility of further editing:
IList<Products> productsList = dbSession.CreateCriteria(typeof(Products)).List<Products>();
BindingList<Products> productsBindingList = new BindingList<Products>(productsList);
productsBindingList.AllowNew = true;
productsBindingList.AllowRemove = true;
dataGridView.DataSource = productsBindingList;
Answer the question
In order to leave comments, you need to log in
The DataGridView should have events for deletion from the list or editing, you just need to subscribe to these events and remember the IDs of deleted and edited products, and in the save button, take objects with the necessary IDs from the list and carry out the operations of deleting / editing objects using the hiber.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question