All Csla derived objects properties must have at least one validation rule?

All Csla derived objects properties must have at least one validation rule?

Old forum URL: forums.lhotka.net/forums/t/1015.aspx


Lnk posted on Friday, August 25, 2006

Hi all...

We are using CSLA 2.1 Beta.

Our problem is that we have a boolean property in a business object that doesn't need to have any validation rule. It's only possible values are true or false and the value is false by default so no validation rule is required.

When the PropertyChanged Method is called for this property we receive a System.NullReferenceException exception that is caused by the following line of code:

Dim list As List(Of IRuleMethod) = rules.GetRulesForProperty(propertyName, False).GetList(True)

in the ChechRules procedure of the ValidationRules Class.

That line of code shouldn't be processed because there is no rules for that property.

The thing is that in RulesToCheck property of ValidationRules class the variable instancerules is not nothing when it should.

So the question is?

Do we need to add validation rules for all the properties of our Csla derived objects?

or

Is this a bug?

Thanks in advance.

Emilio.

Brian Criswell replied on Friday, August 25, 2006

Try again with the newest version of the 2.1 beta.  I think Rocky posted a bug fix refresh today or yesterday.

xal replied on Friday, August 25, 2006

Hi Emilio,
Yes, that was a problem with the original prerelease of 2.1. The latest one fixes that issue.

Andrés

Lnk replied on Thursday, August 31, 2006

Thanks guys...

Everything is working now.

Emilio.

Copyright (c) Marimer LLC