I'm using Csla 4.1 along with Bxf, and a ViewModel based on a DynamicBindingListBase. For some reason that I don't understand the CanSave is always false. When I debug the code in ViewModelBase.ca, in the method SetProperties the first line is
ITrackStatus targetObject = Model as ITrackStatus;
If I look at the value of Model is not NULL but equals the number of records in the DBLB, I'll step to the next line and inspect targetObject and its Null, its always NULL and because of that the following lines of code never get executed and the CanSave is always False. Is this happening because I'm using a DBLB business object ?
// Does Model instance implement ITrackStatus
if (targetObject !=null)
{
CanSave = CanEditObject && targetObject.IsSavable && !isObjectBusy;
...
I have since changed the BO to a Editable Root List and now the CanSave works as expected.
Does a DBLB support CanSave ?
Or is this a bug of somekind ?
Or is there something I'm missing in reguards to a DBLB object ?
DynamicListBase will save changes immediately to each row when another object is selected.
(ie - Nether you or the ViewModel can control the Save method).
So the ViewModel is created for BusinessListBase lists - not DynamicListBase lists and will not work well with DynamicListBase .
Read the preveious threads about VievModelBase and DynamicListBase:
http://forums.lhotka.net/forums/p/10021/47022.aspx#47022
and http://forums.lhotka.net/forums/p/9978/46789.aspx#46789
Copyright (c) Marimer LLC