Search Wiki:

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

Property Validation Base classes BaseBusinessClasses

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
Last edited Apr 5 at 11:50 PM  by SimonCropp, version 42
Comments
dmeineck wrote  Dec 18 2006 at 9:33 AM  
This is really cool stuff. I want to create a business object class that can be data bound against (by a third party). Unfortunately when I derive from the Base Class I get two extra public properties which are then exposed and shown on a grid view. This would not be a problem for me except that the person doing the data binding with a control doesn't know about the properties of my class (it will ultimately be autogenerated by the codedom).

More information on the ValidationManager would be really helpful, as would a code sample on this.

Keep up the good work.

Dan

SimonCropp wrote  Dec 30 2006 at 5:20 AM  
Dan
I have responded to your question in the developers forum
http://www.codeplex.com/ValidationFramework/Project/DisplayThread.aspx?ForumId=2055&ThreadId=3202

expresso wrote  Jan 31 at 12:13 PM  
Where is the sample code for the presentation layer? How do you use this and what controls in an aspx?

monzeremam wrote  Mar 13 at 2:13 PM  
Good work,It's easy to learn one but full featured.
Although I have few suggestions and I will post them in developers forum and hope the hear from the developers team.

mstrobel wrote  Mar 17 at 3:16 PM  
Nice work, but might I suggest renaming ValidatableBase.ErrorMessages to ValidatableBase.ValidationErrors to better avoid name collisions? People might use 'ErrorMessages' for purposes other scenarios. Just a thought. Thanks for helping to beautify the wasteland of WPF validation support ;).

Updating...