Project Home Page
Apply reusable and customisable rules to properties and methods to provide validation for your strongly typed business objects. Works with WPF, ASP.Net, Windows Forms, ASP.MVC and web services.
Language: C# (library is written in C# but can be consumed by any .net assembly)
.net Runtime: 3.0
Quick Starts
Quick Starts are working runable application that illustrate the use of the framework.
So far Quick Starts exist for the following
If anyone would like to add or request a Quick Start for a specific language or technology then make a post on the Discussions.
Frequently Asked Questions FAQ
Validation types
Parameters, fields or properties can be validated based on a set of rules. The result can be used to either throw an Exception or return an error message.
Addition of rules
Rules can be added to member (properties and parameters of methods) through the use of the following means.
- Attributes
- Runtime code
- XML configuration
Included rules
- CompareRule - validates based on a comparison to a given value.
- LengthRule - validates the length of a string, array or collection
- RangeRule - validates that a value is inside a range
- RequiredRule - validates the existence of a value
- EnumerableDuplicateRule - validates that there are no duplicates in a IEnumerable
- RegexRule - validates against a regular expression
- CustomRule - validates using custom .net code
- DateTimeConversionRule - validates that a string can be converted to a DateTime
- NumberConversionRule - validates that a string can be converted to a Number
- EnumConversionRule - validates that a string can be converted to a Enum
Several base classes exists to fast track development of validatable classes.
No. You do not need to use the provided base classes to make use of the validation framework.
Web Validators creation for properties
Supports the creation of Web
BaseValidators based on the rules applied to properties.
For example; a RequiredRuleAttribute will automatically generate a
RequiredFieldValidator. Client side javascript Web
BaseValidators are generated for most rules. All rules support server side Web
BaseValidators.
Some sample code
SampleCode
Credit where credit is due
Based on an article written by
Steve Michelotti for VisualStudio Magazine