How to Trigger Business Rules Validation on the Client (Blazor/CSLA) #4698
Replies: 2 comments 9 replies
-
Which version are we talking about? |
Beta Was this translation helpful? Give feedback.
-
The intent behind the CSLA rules engine is that you make your rules smart enough to handle your scenario. So if you want a rule to take into account the state of the object (or its logical location, like server or client) you can do that within the rule's implementation. Also, as others have pointed out, you can use rule priorities or rule chaining to add conditional rules that check things like the object's state independent of a specific rule, so you don't need the rule itself to become more complex. For example, if you have a rule that should only run if an object is new, then you can have a gateway rule that checks to see if |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm facing the following problem with business rules that validate production order issuance dates:
When I fetch data from the database in the DataPortal_Fetch method, the BusinessRules.CheckRules() method is invoked, applying the business rules to the dates. Essentially, the rule states that a production order for an expired purchase order cannot (or should not) be issued. As a result, my object is returned to the client as invalid, preventing the production order from being saved.
What I need is a way to tell CSLA that if the user wants to force a save, it should skip the business rules. On the client side, I'd like to call something like BusinessRules.CheckRules() to evaluate a property that indicates whether the save should be forced (acknowledging that the user is aware the dates are not compliant).
I can't figure out how to implement this in my Blazor client, such as calling myObject.CheckRules().
Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions