Validation Rules

Validation Rules

Old forum URL:

erescalla posted on Friday, July 18, 2014

Hello I use to add validation rule to my object just with a function and add that function to the broken  rules list , now if i understood well i have to create a class that inherits from business rules, and create an execute method that validate the rule, My version of CSLA was 1.3 or something. Is this the only way to add broken rules? 

JonnyBee replied on Saturday, July 19, 2014

Yes, things have changed a lot since version 1.

In version 4 you must have:

You can create lambda rules that is simple to look at. See this post from Jaans:

And you may also use most of your csla 3.6 or newer validation rules by using the Csla.Validation package.

Csla does NOT provide and means of interacting directly with the BrokenRulesCollection. Each rule provide a RuleResult list and the rule engine has the responsibility of updating the BrokenRulesCollection.

JonnyBee replied on Tuesday, July 22, 2014

Yes, assuming we are talking about CSLA version 4.x.

You must crate a rule class that has a Execute method and the rule engine will make sure to update the BrokenRules collection.
CSLA does NOT provide any methods to allow you to update the BrokenRules list. It must only be updated by the RuleEngine. 

A special version of rules is the Lambda rule and search the forum for QuickRule to see some samples and code on a Fluent like Lambda rule from Jaans. 

Copyright (c) Marimer LLC