I updated a fairly old project to use CSLA 4.5, and suddenly noticed that my Delete buttons linked to the CommandManager of the CslaDataProdiver were not getting enabled when they should. After downloading the source code and looking at the process in question I realized that the cast in the CanExecuteRemove from BusinessListBase to IBindingList would not work, because the implementation now uses ObservableBindingList and not ExtendedBindingList as previously, and ObservableBindingList does not implement IBindingList. So, after looking around a bit more and scratching my head, as to how best to fix it, I came up with 3 changes. There is probably a more elegant way of implementing this, but this works for me now. Hopefully it gets fixed in an upcoming release.
First change: (In CslaDataProviderCommandManager class)
Second change: (In CslaDataProvider class)
Change 3: (Added the following to IObservableBindingList)
Hope this makes sense.
David
Yikes !!!! Just realized that I have to apply the same sort of changes for CanExecuteNew and associated code. Am I completely missing the boat here, or is this really a bug ?
David
Change your code to use BudinessBindingListBase / ReadOnlyBindingListBase base classes. These are the "old" BindingList base classes.
The CslaDataProvider is included primarily for support of legacy code.
Thanks Jonny, I actually forgot about Rocky's post I read about renaming the classes to keep compatibility. I should have through about that. If CslaDataProvider is legacy, then what approach should I use in new code ?
David
For SL and WPF most developers use MVVM frameworks and the CSLA.Xaml.ViewModel or ViewModelBase is a good starting point for creating the VewModel
Copyright (c) Marimer LLC