Creating Your First Rule


When trapping for business rule violations, it is a good idea to map out what those business rules are. For your Region objects, you are going to use database constraints because this is a simple object and there are no true business rules. It will give you a good chance to understand how business rules work.

There are only two rules you can check for at this time—one is for zero-length strings and the other is for values longer than the allowable value. You do not want to allow a zero-length string into a column that does not accept nulls because a zero-length string defeats the purpose of this. If you enter a zero-length string into the RegionDescription column, that is not a null value, and you would end up with a region with no name—obviously something you do not want. So, you can come up with two different error classes, one to handle values longer than the maximum length and one to handle a zero-length string values.




Building Client/Server Applications with VB. NET(c) An Example-Driven Approach
Building Client/Server Applications Under VB .NET: An Example-Driven Approach
ISBN: 1590590708
EAN: 2147483647
Year: 2005
Pages: 148
Authors: Jeff Levinson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net