I'm brand new to CSLA. While refactoring, I changed the name of a property from 'BookName' to just 'Name'. But I neglected to change the corresponding parameter name in ValidationRules.AddRule. Is there a better way to determine the name of the property to validate in the .AddRule method, so that I'd get a design-time error if I'm using a invalid parameter name? Thanks for your help. - Steve
I am far from an expert on CSLA ... but I can't think of any way to make your build break when you have a mismatch.
I write Unit tests for my validation rules and make sure I can break my rules to prove they are working. This way after you refactor you run your unit tests and find your failure.
Doug
Yes, I’ve considered this – for validation and
authorization both.
This could be in addition to the current scheme, but not in
place of. The current scheme supports good globalization and dynamic
configuration (data-driven) of the objects.
It would be slower of course, because getting custom attributes
is one of, if not the, slowest reflection operation. But if done only for
per-type rules it probably wouldn’t make any meaningful difference.
Rocky
From: xal
[mailto:cslanet@lhotka.net]
Sent: Wednesday, May 23, 2007 5:19 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Newbie here - Validation Rules question
Rocky, have you ever considered creating a rule attribute
where you can pass the delegate? Maybe a couple of overloads where you can
define a friendly name and maybe even default severity?
Andrés
Copyright (c) Marimer LLC