Async Business Rule & Can Save

Async Business Rule & Can Save

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


MadGerbil posted on Thursday, October 20, 2011

Greetings:

I'm using CSLA 4.2.0 Beta.

I've several business rules on my objects which are all part of a collection.  I've the "Save" button wired up to a CanSave implementation which is wired to IsSavable that is updated every time a child in the collection changes.   The button is enabled and disabled as it should be when I'm working with regular business rules.

However, my single asynchronous rule doesn't cause an update to the "SAVE" button's enabled property.  The asynchronous rule works just fine - the entire row of data become valid or invalid when the rule is invoked but for some reason, just on the asynchronous rule, the infrastructure put in place to handle the enable/disable of the button doesn't do a thing.

So all the rules work, it's just the async rule that refuses to trigger an update of the "SAVE" button status; however, other visual elements (invalid cell indicator on the grid) update as expected whether the rule is async or not.

Any ideas?

JonnyBee replied on Thursday, October 20, 2011

Look at the implementation in Csla.Xaml.ViewModelBase.

You should make sure to update the CanSave (and other "meta" properties) also when BusyChanged event is raised.

Copyright (c) Marimer LLC