Best way in CSLA to enforce one of two boolean properties are true? #1744
Unanswered
MarkOverstreet
asked this question in
Questions
Replies: 1 comment 4 replies
-
The short version (b/c I'm not at a computer) is that you create a rule that has a primary and affected property as inputs to the constructor. In the rule you get the primary property value, and based on your rule, you might change the affected property using Then add the rule to each of your properties, with the other property as the affected property. The one thing to watch for is that you want to make sure your logic doesn't create an infinite loop, where changing one property causes a change to the other, and the change to the other also causes a change to the first one - clearly a bad thing!! 😊 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Pretty new to CSLA so I'm sure this will be easy for someone but I have a simple root object defined and I have two properties as seen below:
I simply want to make sure that one and only one of these are true at any given time but I don't really want to create a business rule and let the user select both only to get an error. I'd prefer to just set one to false automatically if the other is set to true and vice versa. I tried to add some code to the Setter to do this but that causes some strange behavior along with some analyzer messages complaining to me not do to that in CSLA.
So what would be the best way to implement that?
Thanks
Mark
Beta Was this translation helpful? Give feedback.
All reactions