Choose Members - Read Existing ValidatorAttributes and Transfer to XML

Topics: Validation Application Block
Jan 21, 2007 at 11:55 PM
I love the "Choose Members" option when adding members of a class to be validated in the app.config, web.config, etc. From there, one would then add validators to each member.

A nice addition would be to read any existing ValidatorAttributes on those class members and ask if I want them to be added to the config file.

Hence, if I had the following class:

public class Customer
public string Name { get; set; }


When I select the Customer Type using the config tool and then select "Choose Members", I would like the option of adding any existing ValidatorAttributes ( as shown above ) to the config file.

Maybe this is just a global checkbox and/or a checkbox per type where I indicate which type's attributes I want to be added to the xml config file.

This would be great for moving from attributes to xml-based validation. I wouldn't have to add all the attribute declarations in the xml file manually.




David Hayden
Microsoft MVP C#