I started using nhibernate but noticed there were good data binding helpers for nhibernate POD object lists (e.g. from a Criteria method call).
I looked through the code in ObjectViews. It was not apparent that it could help me do the following without any changes to my POD object structure or nhibernate subclassing. I need to have long conversation ability while users are editing the data in my application.
Can someone help point the way?
Requirements:
a) Provide the ability to roll-back at the UI layer, changes to objects. Think of a BindingNavigator with a "Reset" button to reset all object changes being edited in a DataGridView I did see IEditableObject functionality but this is only used during the actual edit cycle versus after editing multiple objects then calling reset on all of them (like a RejectChanges() on a datatable. Since I have long conversations, I saw recommendations to avoid nhibernate transactions to do this.
b) Allow me to understand which objects are new, deleted (but not use ISession.Delete() until I am ready) or have been changed using something like a DataRowState mechanism. Calling AcceptChanges would be nice. One could subclass the BindingSource object and trap the add, delete, changed events, but there is no state information kept. I was hoping ObjectViews had some of this builtin already. Also, this would not allow me to automatically create different versions of the object in the same spirit of DataTable and DataRowState.
Thoughts? I know this is slightly different than the ObjectView intended functionality.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the same requirements that you have for my application. There's no support for such things in objectviews, so I used the traditional Dataset for databindigs with those requirements. One thing that helped me a lot is the CreateDatatable method to populate those datasets. The way I use nhibernate-objectviews-dataset is:
1. query DB using hibernate
2. assign retrieved collection to objectviews.Datasource
3. merge dataset datatables using objectviews.CreateTable()
4.let user make changes to data
5. process changes using dataset's getchanges()
Pay special attention to detached-transient objects if you use hibernate's session.saveorupdate()
Regards.
Marcelo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I started using nhibernate but noticed there were good data binding helpers for nhibernate POD object lists (e.g. from a Criteria method call).
I looked through the code in ObjectViews. It was not apparent that it could help me do the following without any changes to my POD object structure or nhibernate subclassing. I need to have long conversation ability while users are editing the data in my application.
Can someone help point the way?
Requirements:
a) Provide the ability to roll-back at the UI layer, changes to objects. Think of a BindingNavigator with a "Reset" button to reset all object changes being edited in a DataGridView I did see IEditableObject functionality but this is only used during the actual edit cycle versus after editing multiple objects then calling reset on all of them (like a RejectChanges() on a datatable. Since I have long conversations, I saw recommendations to avoid nhibernate transactions to do this.
b) Allow me to understand which objects are new, deleted (but not use ISession.Delete() until I am ready) or have been changed using something like a DataRowState mechanism. Calling AcceptChanges would be nice. One could subclass the BindingSource object and trap the add, delete, changed events, but there is no state information kept. I was hoping ObjectViews had some of this builtin already. Also, this would not allow me to automatically create different versions of the object in the same spirit of DataTable and DataRowState.
Thoughts? I know this is slightly different than the ObjectView intended functionality.
Thats....there were [not any] good...
I have the same requirements that you have for my application. There's no support for such things in objectviews, so I used the traditional Dataset for databindigs with those requirements. One thing that helped me a lot is the CreateDatatable method to populate those datasets. The way I use nhibernate-objectviews-dataset is:
1. query DB using hibernate
2. assign retrieved collection to objectviews.Datasource
3. merge dataset datatables using objectviews.CreateTable()
4.let user make changes to data
5. process changes using dataset's getchanges()
Pay special attention to detached-transient objects if you use hibernate's session.saveorupdate()
Regards.
Marcelo
Thanks. I'll look into that.