Using CSLA 4.3
I notice that a business object isn't busy even thru there are business rules active. Is there a reason for not implementing that in the base? For ASync rules i can understand that, but the Sync rules are causing the main thread to be very busy where alot of custom code can be listening to OnPropertyChanged. Is it a mistake to believe that a BO is busy while sync business rules are running?
Ofcourse i can do this, but i might be missing some fundemental reason.
public override bool IsBusy { get { return !BusinessRules.RunningRules && !BusinessRules.RunningAsyncRules && base.IsBusy; } }
Hi,
If the sync rules takes time the your main UI thread will be busy and can not do any other processing. .
The rule engine will not raise PropertyChanged - this is done by the base class after rules have completed (in either PropertyHasChanged or CheckObjectRules).
I would not mark the object as busy while sync rules is running - as the sync rules are running on the UI thread and making this busy. You cannot f.ex show a message to the user because the UI thread is busy.
For Async runles - running on other threads this makes sense and is implemented.
It's the cascading stuff in our abstraction layer doing a new CheckRules with the properties that changed, in there the OnPropertyChanged is done foreach property affected. Yes, i know, it's wrong. It's a workaround not implemented by me. I agree that OnPropertyChanged should not be done while running business rules. Again it ends into that it would be nice to have the rule engine checking if a value changed and if it did then run the 'cascade' business rules again.
Copyright (c) Marimer LLC