Validation Data Annotations and XSD2Code.....

Feb 21, 2013 at 11:21 AM

What is the best way to use Data Annotation Validations with XSD2Code generated classes. Obviously one can create buddy classes and manually add the annotations, but there must be a better method. I did look in nuget for some form of buddy class scaffolder, but could only find one that read EDMX files for EF classes.

Also this also asks the question as to whether it would or could be possible to define validation in the XSD Schema file via facets and have these validations carried across into the .NET class as Validation Data Annoations. I think they are called "restrictions", and one can set minimum length for values etc. Also one can set patterns for valid data, basically all good schema validation functionality.