CSLA .NET

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

Delay calculation business rules execution

rated by 0 users
This post has 1 Reply | 0 Followers

Top 25 Contributor
Posts 363
rfcdejong Posted: Wed, Jul 4 2012 7:34 AM

Having:

- differend kind of business rules, validation and calculation.
- In a view with databinded controls with binding UpdateSourceTrigger=PropertyChanged.
- not using PropertyStatus, but instead using a customized solution looking at the brokenrules of a BO.

The nice thing about this is that business rules will be executed right after a key press and that way a validation like 'Required' is valid and marked as success. 

On the other side the calculate business rules should not calculate until the property hasn't changed for 0.5 miliseconds or so.

I looked at the Delay attribute in the WPF 4.5 Binding, but that won't execute the validation business rules either.

On the other hand, writing a custom markup extension binding it would perhaps be possible to write some generic code which also set's a property on the BO to supress calculation business rules when the delay is active, after that the calculation business rules should execute.

What would you (anyone, as the reader) recommended? All comments are welcome.

Top 10 Contributor
Posts 1,769

Hi,

With the "business object" perspective - a value is either written to the BO.Property or not.

So the BO will not know whether this happened as a PropertyChanged or Validated in the UI. 

I have no good answer for this - the BO has no knowledge of the "context" by which the property was changed. 

You could probable create your own "thread" context and Markup Extension Binding - to set the context value for PropertyChanged or Validated and then check for this is your calculation rules. However - this will have to be your own custom context and code - not supported by CSLA here. 

Jonny Bekkum, Norway CslaContrib Coordinator

Page 1 of 1 (2 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