Friday, June 3, 2011

Data Annotations Extensions

The System.ComponentModel.DataAnnotations contains the most basic validation rules like

  • String length
  • Required
  • Range
  • Regular expression

These validators can be used for many things, but sometimes they just aren’t enough. That’s where the open source project DataAnnotationsExtensions comes to the rescue. It contains many of the most sought after validators, and some less used ones too. Currently it contains the following validators:

I’ve added links for each validator to the demo page on their web site. The project comes in two versions, one which only contains server side validation, and one which also supports client-side validation with ASP.NET MVC3. Both versions are available for download from NuGet and from the DataAnnotationsExtensions download page.

The library just makes data validation in ASP.NET Dynamic Data and ASP.NET MVC much easier and more readable.

No comments:

Post a Comment