CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

BO is not busy while business rules are running?

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 0 Followers

Top 25 Contributor
364 Posts
rfcdejong posted on Fri, Jul 6 2012 4:43 AM

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;
            }
        }

Answered (Verified) Verified Answer

Top 10 Contributor
1,815 Posts
Verified by rfcdejong

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.

Jonny Bekkum, Norway CslaContrib Coordinator

All Replies

Top 10 Contributor
1,815 Posts
Verified by rfcdejong

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.

Jonny Bekkum, Norway CslaContrib Coordinator

Top 25 Contributor
364 Posts

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.

Page 1 of 1 (3 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems