Using the Framework classes, is there is neat and easy way of annotating
properties of a class with validation rules and then validating the rules
to get the error(s)?

I ask because the DataAnnotations
<http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(v=vs.110).aspx>
namespace has dozens of attributes for defining the rules and data format
of properties, but I can't find anything that then processes the rules to
give you results. I get the impression these attributes are just for
code-first.

I can also implement IDataErrorInfo
<http://msdn.microsoft.com/en-us/library/system.componentmodel.idataerrorinfo(v=vs.110).aspx>
but it seems designed for use in UI binding and again I can't find who
actually runs the validation.

I just wanted to annotate a class with rules and then process then when I
want with minimum effort, independent of the environment. Is there some
trick I'm missing?

*Greg K*

Reply via email to