This project has moved. For the latest updates, please go here.

Adding Data Annotation to Class

Oct 7, 2013 at 4:11 PM
i would like to add Annotation Attributes to the POCOS generated, is it possible?

Thank you
Oct 9, 2013 at 9:30 AM
In CodeGen there is a DataAnnotationWriter, but it's internal and only creates a minimal set of System.ComponentModel.DataAnnotation attributes for validation. It's not extensible for now.

It should be easy to inject a simple interface, or even just a Func, to the CodeWriterSettings, which is called when properties are written, so you could add custom attributes.

Would this be interesting?
Oct 9, 2013 at 3:18 PM
Thank You Martin for the quick reply. I added a custom property and it worked like a charm.
You have done a terrific job with this :) congrats!