Hi,
I'd like to know if anyone knows of any resources detailing the best
practices of validating rules in the business tier and providing
helpful error messages to users in the UI tier. All the information I
have come across seems to revolve around using validation controls on
the webpages themselves, which is not always feasible.
Regards,
Chris
Cowboy (Gregory A. Beamer) - 27 Jul 2007 22:56 GMT
There are a couple of things you can do. IN general, however, I find it
easiest to throw exceptions up to the UI for problems and then parse the
exception there. It is very specific and does not require passing back
values.
Of course, you can also use enums.
public MyEnum TestValidation()
{
if(failedOneValidation())
return MyEnum.FailedOneValidation;
if(failedTwoValidation())
return MyEnum.FailedTwoValidation;
}
But, this is harder if you embed it down levels, which often happens in
tiered approaches. Exceptions can bubble all the way to the UI and be
handled there.
To make sure these validations are logged, you can use the new policy
injection block (part of EntLib 3.1). Then you can turn on or off items by
config.

Signature
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)
************************************************
Think outside the box!
************************************************
> Hi,
>
[quoted text clipped - 7 lines]
>
> Chris
bruce barker - 28 Jul 2007 01:10 GMT
a common approach popular in the java world is to use a rules engine
thats hosted by the business logic layer (JBoss, JxBRE, SRE, etc). this
layer can also pass info used to generate the page validators, so
validation logic is all in one place.
on sourceforge.net, along with the java source you can find some .net
ports. there are also commercial products.
-- bruce (sqlwork.com)
> Hi,
>
[quoted text clipped - 7 lines]
>
> Chris