Print
Add To Favorites
Email To Friend
Rate This Article
|
Working with Custom Validators using Enterprise Library 3
|
Published:
13 Apr 2007
|
Abstract
Enterprise Library 3 contains the ability to validate a business object and this validation occurs through a standard range of validators. The Framework also provides the ability to create custom validators, which is where this article will continue on to discuss the additional features of the Validation Block. |
|
by Brian Mains
Feedback
|
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days):
32493/
124
|
|
|
Introduction |
Previously, I wrote about Enterprise Library 3 validation in
ASP.NET pages, using the existing Validator classes defined in the
Microsoft.Practices.EnterpriseLibrary.Validation namespace. Through
inheritance, it is easy to create your own custom validation and we will look
at a few examples of this and see how you can create your own in your
applications.
|
|
|
User Comments
Title:
mmm Reply
Name:
Brian
Date:
2008-06-23 10:46:18 AM
Comment:
Validator doesn't inherit from that class, correct. You have to create an accompying attribute that works along side of it. Create another class that inherits from ValidatorAttribute (the attribute class). It has a method you need to override that uses your validator to validate the data. Sorry, I didn't include it in the article.
|
Title:
mmm
Name:
John
Date:
2008-06-21 11:58:45 PM
Comment:
Base class Validator don't inherit System.Attribute. How can i use it in this way: [StringLengthValidator(7, RangeBoundaryType.Inclusive, 150, RangeBoundaryType.Inclusive, "The email address must be between 7 and 150 characters", Ruleset = "primary") , ContainsCharactersValidator("@.", ContainsCharacters.All, "The email must have an @ and at least one period", Ruleset = "primary"), EmailDomainValidator(".com", ".net", ".edu", ".gov", ".biz", ".tv", Ruleset = "primary")] ????
|
|
Product Spotlight
|
|