BusinessListBase - adding/removing items IsDirty

BusinessListBase - adding/removing items IsDirty

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


xetal posted on Friday, April 09, 2010

Curious as to why adding and removing items from a BusinessListBase doesn't call OnPropertyChanged("IsDirty"). 

RockfordLhotka replied on Friday, April 09, 2010

All the metastate properties (IsDirty, IsNew, etc) are marked as Browsable(false) so they aren't bindable.

In Windows Forms this meant they really weren't bindable at all, so raising the event would be meaningless.

In WPF/SL that doesn't appear to be the case any longer. The problem now is figuring out how to globally (in BB, BLB, ERLB) raise the event in a way that doesn't degrade performance. Over the past decade or so, I've made implementation choices based on the fact that those properties are passive. That means there's no existing plumbing to keep the properties "up to date" from instant to instant. Instead, many of them are calculated only when used, which is obviously nice for performance.

I thought about changing this in CSLA 4, but there's a very real risk of breaking existing Windows Forms apps, or at least substantially harming their performance (by causing multiple rebinds by the UI any time anything changes). So I have opted to leave the behavior as-is for now.

Both WPF and SL have good solutions to this through the ViewModelBase, CslaDataProvider, ObjectStatus and PropertyStatus controls. So it isn't really a pressing concern for modern UIs, and it is a dangerous thing to "fix" for legacy UIs.

I will probably change the behavior in some future 4.x release as the use of Windows Forms fades away. Certainly by CSLA 5 I'm sure I'll change the behavior so the metastate properties update live and raise notification events.

xetal replied on Friday, April 09, 2010

Thank you for the quick reply and explanation.

Copyright (c) Marimer LLC