We discussed using data annotations in Chapter 7 when we explored the Code First workflow. At that time I said these are just a special set of .NET attributes. What I didn’t say then was that some annotations also trigger validation.
Any annotation that descends from the
ValidationAttribute class in the
System.ComponentModel.DataAnnotations namespace will be included in the validation pipeline. There are eight in .NET 4.5, seven in .NET 4.0. (
Compare is the new one.)
Put On Your Thinking Hat
Ready to give it a shot? You ...