CSLA BusinessListBase, edit level not being set when binding.

CSLA BusinessListBase, edit level not being set when binding.

Old forum URL: forums.lhotka.net/forums/t/10283.aspx

Matthew posted on Tuesday, April 19, 2011

I'm looking at  the edit level of a list and its children after binding.  Its my understanding the edit level on the list should go to from 0 to1 when I bind(assign to ultragrid's datasource).  But instead the edit level on the children in the list is incremented(not the lists edit level) - every time I assign to datasource there incremented by one , if either called from the list or directly on the children, they don't reset in a certain situation.

So if I don't explicitly call BeginEdit on the list it never takes the snapshot and canceledit on the list fails to undo additions. Also if I call begin edit on the list after binding(were the children's edit level is only effected), it increments the childrens edit level once more to 2( 0 - 1 from binding).  I have confirmed that the BusinessBase classes are marked as children, so I don't understand the disconnect, the binding to the grid bypasses the list leaving its edit level at 0 and the children are set to 1.

This is only symptoms/part of another bug I'm getting were I simply open the form containing the grid and then cancel, then go back in the grid and add an item, cancel again and a child fails to revert. Any other circuimstance seems to work correctly.

Please can I get some verification on what the behavior should be when binding to a data grid/ultra grid, and any other suggestions would be helpfull.




RockfordLhotka replied on Tuesday, April 19, 2011

I suggest updating to at least 2.1.4, or better yet to 3.0.5. You can read the change logs for the versions higher than 2.1.1 on the download page (http://www.lhotka.net/cslanet/download.aspx), but I recall making a lot of changes and some bug fixes to the way edit levels and data binding interact during that time.

Somewhere in there (probably in 3.0) is when I quit trying to fight data binding, and decided to completely conform to the way the DataTable works. That was a big deal, because Windows Forms data binding is really inflexible, and it turns out that conforming to the DataTable behavior is the only way to make things really work...

Copyright (c) Marimer LLC