CSLA .NET

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

AffectedProperties Issues

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 0 Followers

Not Ranked
5 Posts
JasonBock posted on Fri, Jun 8 2012 3:27 PM

I don’t know if it’s because CSLA isn’t working as I thought it should, or I'm making a bad assumption, or what, but I have a confusing issue with business rules and affected properties.

Here’s the simple example. I have three properties, A, B, and C. A affects B, and B affects C, meaning, B is in the list of AffectedProperteis for A, and C is in the AffectedProperties list for B. I change A, and now B is required. I change B, and now C is required.

This is what I want…except…when I change A, only B gets affected. C’s rule does NOT fire, and so it looks like C is still in a broken state.

Do I need to set C as an affected property in A? And if this is the case, I have to make sure B is before C in A's AffectedProperties list, correct? This seems like it should be unnecessary, but I can’t figure out what else to do. Any insight is appreciated - TIA

All Replies

Top 10 Contributor
1,772 Posts

Hi Jason,

Yes, AffectedProperties only works for the "first" level - in order to avoid circular dependencies.

Is this "lookup" rules that updates properties?

So your options is to

  • Add C to A's AffectedProperties or
  • Override PropertyHasChanged and add specific code for revalidaion of property C after regular check of property A's rules. 
  • Create one rule that sets Error on all properties A/B/C thast triggers when one of the rules is changed (by using InputProperties that is now also considered as Dependency)

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