When objectview.addnew is called, a new instance is created and added to the Datasource. If the row canceledit is called the new object is removed from the Datasource.
Is it a better approach to have a temporary newobject objectview private instance variable that holds the new instance? If endedit is called, in that moment the new instance would be added to the datasource, if canceledit is called, we can dispose that temporary object.
What do you think?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if you have any validation in the iList class over new items added, that validations are raised in new items that are not yet accepted by the user (through an EndEdit).
If my suggestion is implemented, no validations will be raised until EndEdit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
AddNew() is part of IBindingList. It is supported to add a new object to the list and return a reference. It's not behavior we can change if we want to work with databound controls. BeginEdit() and EndEdit() are part of another interface, IEditableObject(), which ObjectViews implements.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm also interested in a .NET 2.0 version of ObjectViews. Could you give a brief overview of what ObjectViews offers above and beyond the new databinding features in .NET 2.0? Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Mainly just the ability to flatten a fine-grained object model to bind to. (The new framework classes still don't cover this, unless I missed it. I'd like to know if I did :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When objectview.addnew is called, a new instance is created and added to the Datasource. If the row canceledit is called the new object is removed from the Datasource.
Is it a better approach to have a temporary newobject objectview private instance variable that holds the new instance? If endedit is called, in that moment the new instance would be added to the datasource, if canceledit is called, we can dispose that temporary object.
What do you think?
What will be the advantage of this?
if you have any validation in the iList class over new items added, that validations are raised in new items that are not yet accepted by the user (through an EndEdit).
If my suggestion is implemented, no validations will be raised until EndEdit
AddNew() is part of IBindingList. It is supported to add a new object to the list and return a reference. It's not behavior we can change if we want to work with databound controls. BeginEdit() and EndEdit() are part of another interface, IEditableObject(), which ObjectViews implements.
.NET 2.0 has a new intreface for this: System.ComponentModel.ICancelAddNew
If we move to support .NET 2.0 (which I want) then we can implement this.
I'm also interested in a .NET 2.0 version of ObjectViews. Could you give a brief overview of what ObjectViews offers above and beyond the new databinding features in .NET 2.0? Thanks!
Mainly just the ability to flatten a fine-grained object model to bind to. (The new framework classes still don't cover this, unless I missed it. I'd like to know if I did :)
No, you didn't miss it. It's a real shame it's not supported because it's pretty useless right now.
For a .NET 2.0 ObjectView, I suggest looking at extending the BindingSource class (which has a lot in common with ObjectViews).