This project is read-only.

This is a contrib project for extensions to the System.ComponentModel.DataAnnotations namespace included in .net 3.5 and extended in 4.0. The project consists of a library of attributes which add business domain validation to the base validators. Founded by Mark Johnson.

A full list of currently complete (or in progress) validators and any documentation is here.


29th May 2010: Upgraded solution to Visual Studio 2010/.Net 4.0, including moving references to framework 4.0 version of System.ComponentModel.DataAnnotations.
24th March 2010: Unfortunately nothing new in-project, but with the recent release of Asp.Net MVC 2 here and its substantially increased reliance on the service of System.ComponentModel validation I plan to dedicate some more time to finishing the UpuPostalCodeValidator and add a couple of other (less labour intensive) classes over the next few weeks, just in time for the full release of .Net 4.0.
11th November 2009: Iso9362SWIFTBICValidator added. Country support of UpuPostalCodeValidator expanded to 24 and negative tests added.
9th November 2009: UpuPostalCodeValidator (with support for Australia/Argentina/Bermuda/Barbados/Canada/Great Britain/United States) postal/zip code validation and country inference added with tests. Basic overview documentation also added.
23 July: Project published to the public today 23 July 2009.


I set this project up after having used the DataAnnotationsModelBinder sample in an Asp.Net MVC project. Having previously collected a rag-tag library of various validation routines (focussed primarily on financial concepts such as IBANs/payment card numbers etc...) I saw this as a nice pet project to refactor these into a useful library. Obviously this will initially be personal vanity project, but hopefully I will find enough time (and help) to turn it into something that gains a decent usage as the role of System.ComponentModel.DataAnnotations as a framework integration increases in the 4.0 timeframe.

Current Development 'Timeline'

Implementation will be .Net 3.5 (but based around 4.0 version of System.ComponentModel.DataAnnotations released here; code will move to 4.0 as soon as it is released.
  • 'Iteration' 1: Set up basic algorithm frmaework and attribute layer base classes/interfaces and the necessary test infrastructure to prove approach. (Update: First source code checkin today with basic Luhn Mod 10 based payment card validator and limited tests)
  • 'Iteration 2': Migrate, one-by-one, the 'rag tag' bunch of domain specific validation logic I have kicking around from old projects in to the structure/framework from I1 (ensuring high (~70%) coverage). (Currently these fall into the broad groupings of finance (CC no, IBAN) / identity (various national ID numbers) / misc (ISO3166 Country Code) / telephony (ITUInternationalTelNumber)... (Update: IBAN, ISIN validators now checked in with tests)
  • 'Iteration 3': Implement / accept submissions of the requested validators in popularity or as my own personal whim. Add your suggestions here.


Obviously I am aware of the 'competition' (Castle validation, NHibernate validation and the P&P monolith that is EntLib) and these are all certainly worth your consideration. However if you are looking for something lightweight and seamlessly integrated into MS's frameworks such as Asp.Net MVC (in particular with the DataAnnotationsModelBinder and maybe even xVal) then I would like to think this may be of interest to you.

NOTE: A nice introduction to the raison d’être of the System.ComponentModel.DataAnnotations.dll, and how it is destined to play a larger part in Asp.Net MVC/Asp Dynamic Data and Silverlight RIA Services is here

Last edited May 29, 2010 at 4:53 PM by markscottjohnson, version 18