Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Best practices for validating business rules

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hardieca@hotmail.com - 27 Jul 2007 19:03 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.