DataAnnotations

Aug 31 2009

Null strings in ASP.NET MVC 1.0 with DataAnnotations

After getting DataAnnotations working with ASP.NET MVC 1.0, I noticed a strange anomaly. Values that were previously bound as empty strings were now being bound as null values.

Aug 31 2009

DataAnnotations in ASP.NET MVC 1.0

DataAnnotations is the Microsoft way of declaratively adding validation rules to a model. You simply add an attribute to a property and voila, it has validation! The concept of DataAnnotations should be familiar to anyone who has worked in Ruby on Rails and added validation rules inside the ActiveRecord model. I'm going to go over some of my findings and walk you through using DataAnnotations. Hopefully my pain, will be your gain.

Recent comments