CSLA 2.1 Validation Problem

CSLA 2.1 Validation Problem

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


JZuerlein posted on Monday, August 21, 2006

I'm doing some testing with 2.1 and started coming across some problem when I try to add validation to a  class.  The ValidationRulesManager is not nothing, but the children can not be evaluated.  So when you try to get the list of rules for the property, a null reference exception is thrown.  Has anyone seen this before?

Jeff

   at Csla.Validation.ValidationRules.CheckRules(String propertyName) in C:\InternetDownloads\CSLA2\csla20vb-2.1-060731\csla20vb\csla20vb\Csla\Validation\ValidationRules.vb:line 556
   at Csla.Core.BusinessBase.PropertyHasChanged(String propertyName) in C:\InternetDownloads\CSLA2\csla20vb-2.1-060731\csla20vb\csla20vb\Csla\Core\BusinessBase.vb:line 254
   at EPAS.BusinessObjects.Form.set_DefaultForm(Boolean value) in C:\Projects\EPASV3\EPAS.BusinessObjects\Form\Form.vb:line 168
   at EPAS.BusinessObjects.UnitTests.FormFixture.InsertForm() in C:\Projects\EPASV3\EPAS.BusinessObjects.UnitTests\FormTestFixtures\FormFixture.vb:line 48
   at EPAS.BusinessObjects.UnitTests.FormFixture.Setup() in C:\Projects\EPASV3\EPAS.BusinessObjects.UnitTests\FormTestFixtures\FormFixture.vb:line 34

Protected Overrides Sub AddBusinessRules()

ValidationRules.AddRule(AddressOf CommonRules.StringRequired, "Name")

End Sub


 

RockfordLhotka replied on Monday, August 21, 2006

I appreciate you taking the time to test 2.1!

That sounds somewhat familiar, and is probably resolved in the current code. There were a couple places where I wasn't doing null reference checks quite right - hopefully I've caught them all.

Look for a refresh of the beta code yet this week - both VB and C# this time.

RockfordLhotka replied on Monday, August 21, 2006

So you are saying that AddBusinessRules() isn't being called? There is code in BusinessBase that makes this call - but in the current code it only happens once per appdomain, because these are the per-type rules. In other words, only the first object of a given type gets this call - all subsequent objects of that type do NOT get the call because the per-type rules have already been loaded.

JZuerlein replied on Monday, August 21, 2006

My bad on the post that I have since deleted.  It is being called.

JZuerlein replied on Monday, August 21, 2006

Any way I could get an current build?  A coworker and I are writing the validation code and unit tests this week for a project that's due at the end of Sept.  We need the severity features to make it work, so rather then roll our own...

 

Jeff

 

RockfordLhotka replied on Wednesday, August 23, 2006

Sure, you can use TortoiseCVS to get the current code through anonymous cvs at any time.
 
http://www.lhotka.net/Article.aspx?id=5987a664-4b44-45a7-bc1d-695610964718
 
Just make sure to use the revision tab to get branch V2-1.
 
Rocky
 

Any way I could get an current build?  A coworker and I are writing the validation code and unit tests this week for a project that's due at the end of Sept.  We need the severity features to make it work, so rather then roll our own...

Copyright (c) Marimer LLC