Vibrant discussion about CSLA .NET and using the framework to build great business applications.
I think maybe I'm missing something here.
When I databind a normal businesslist to a windform datagrid, I don't get any sorting functionality out of the grid. I think this is as expected.
I can simply do:
x.DataSource = new Csla.SortedBindingList(of Y)(Y.FetchList())
and that will cause all the sorting functionality to work correctly.
However, in Rocky's book, he says that SortedBindingList and FilteredBindingList are obsolete with the introduction of LINQ.
Am I correct in thinking that using the sortedbindinglist would still be the ideal way to get sorting in a winform grid? I don't see any simple way to get the same results using linq.
Well, they are and they aren't. They're obsolete really because of Wpf and SL, and WinForms is now being considered legacy technology.
But if you're still on WinForms, you should continue to use those classes if needed, because WinForms doesn't understand Linq.
Thanks for verifying that for me. I wasn't sure.
Any idea why the Sorting and Filtering were not built into BusinessListBase back before Linq was an option?
I think its because there's overhead associated with it, and if you don't need it you'd still pay the price. Sorting and filtering is often though just a UI concern, and so shouldn't be part of the business layer. Csla provided those as a convience.
Sorting/Filtering is usually closely connected to functionality in the UI and as such should not be in the core BusinessListBase.
DataSets implement the IBindingListView interface (that supports sorting/filtering) but unfortunately - there is no generic implementation from Microsoft available. There is one open source implementation on SourceForge tho'.
Jonny Bekkum, Norway
It should also be noted that even in WinForms, the 3rd party grids handled their own sorting. Well, at least the DevExpress one did, and I assume the others worked similarly. I always figured that under the hood it was essentially doing the same thing as the Csla.SortedBindingList.
So, the point is there were a lot of scenarios, even in WinForms, where that code would have just been bloat if it were in the core.