Project Home Page
Apply reusable and customizable validation rules to properties, methods, and parameters in your business objects. Works with WPF, ASP.Net, Windows Forms, ASP.Net MVC and web services.
(This library is written in C# but can be consumed by any .net assembly)
Requires: .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
- Windows forms (C# and VB)
- ASP.NET Web Site (C# and VB)
- ASP.NET MVC Web Site (C#)
- WPF (C#)
If anyone would like to add or request a Quick Start for a specific language or technology please post on the discussion board.
Frequently Asked Questions FAQ
Types of Validation
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.
Configuring Rules
Rules can be added to members via:
- Attributes
- Runtime code
- XML configuration
- Fluent Interface In Progess
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.
ASP.MVC - Easily Generate Client-Side Validation from Model In Progress
Easily generate client-side validation from rules defined in your model. The framework leverages concepts for server-side validation provided in MVC preview 5 nearly eliminating the learning curve. We try and make client side generation as lightweight as possible. It shouldn't have much of an impact on the way your MVC project is designed.
Web Forms - Easily Generate Validation Controls
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.
Silverlight (In Progress)
Supports validation inside Silverlight applications
Compact Framework (In Progress)
Supports validation inside Windows CE, Pocket PC and Smartphone applications.
Some sample code
SampleCode
Credit where credit is due
Based on an article written by
Steve Michelotti for VisualStudio Magazine