Async Rules, AddOutValue, and BrokenRules Collection

Async Rules, AddOutValue, and BrokenRules Collection

Old forum URL:

mosgath posted on Wednesday, March 02, 2011

I developing an application that uses CSLA 4.1 with a Silverlight UI.  There is an Async business rule triggered off of Property A that calls asynchronous command objects to connect to a backend system to verify data and populate Properties B & C. Properties B & C can also be manually entered if Property A is blank.  I had the rule update the additional properties using the AffectedProperties and AddOutValue.  Then overwrote the CanWriteProperty to check if the property being written to was Properties B & C and if Property A had any value.  If so, it returned false.  When the rule fires and brings back data, Properties B & C are updated but still contain the broken rules for containing no data.  I understand that AddOutValue uses the LoadProperty method and bypasses the rules and security.  I tried using the dependency rule I use for Synchronous rules to allow the Async rule to fire (Priority: 1) and then dependency rules (Priority: 2) to trigger for the additional fields.  However, it appears the rules for priority 2 trigger even if the async rule with priority 1 hasn't completed.  I also tried updating the fields from the context.Target (not preferred, I know).  This caused the set on the property to error because it was no longer Writeable.  Any thoughts on how I can get the properties updated and rules reran for Properties B & C from the Async rule and still provide the CanWrite check?


mosgath replied on Wednesday, March 02, 2011

Sounds like the changes mentioned here will actually fix my issue:



Copyright (c) Marimer LLC