CSLA Light - Validation

CSLA Light - Validation

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


CampbellCM posted on Tuesday, May 05, 2009

I just added a simple validation rule to one of my BOs and when the validation fails I get the following error message:

Object is still being edited and cannot be saved.

Here is the validation rule:

ValidationRules.AddRule(CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs(DescriptionProperty, 30));

To make the rule fail I'm just exceeding the specified maximum string length. Any idea what I'm doing wrong?

RockfordLhotka replied on Tuesday, May 05, 2009

There's a bug (fixed in 3.6.3) where the Save() method uses the wrong text when raising the ValidationException to indicate that the object is invalid and can't be saved.

The overall behavior is correct - you are getting a ValidationException because you are trying to save an invalid object. The bug is that the text message in the exception is incorrect (again, fixed in 3.6.3).

CampbellCM replied on Tuesday, May 05, 2009

Thanks Rocky. I don't see 3.6.3 on the downloads page. Is it not available for download yet? If not, any idea when?

RockfordLhotka replied on Tuesday, May 05, 2009

3.6.3 is a work in progress. I’ll do a test release soon, maybe yet today.

 

Rocky

 

 

From: CampbellCM [mailto:cslanet@lhotka.net]
Sent: Tuesday, May 05, 2009 12:14 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] CSLA Light - Validation

 

Thanks Rocky. I don't see 3.6.3 on the downloads page. Is it not available for download yet? If not, any idea when?

CampbellCM replied on Tuesday, May 05, 2009

Cool, I'll keep an eye out. Thanks Rocky.

Copyright (c) Marimer LLC