Custom attributes in fields in SubSonic

SubSonic newbe question;

I want to put custom attributes on properties in the generated classes, is this possible?

+2


source to share


2 answers


This is definitely possible. Is it SubSonic 2 or 3? This is possible for one, but the question of where to find the templates depends on which one you are using.



Edit: For SubSonic 2 follow this link and look at the entry in "templateDirectory". For SubSonic 3, you probably have some .tt files in your VS project that you might run into.

+4


source


There are two ways to do this:



  • If you want to add them during generation, you can do what Skinniest Man suggests and modify the templates to add them.

  • If you want to add them manually, things are a little more complicated and you will need to create a buddy ' class and apply your custom attributes to it. You can see an example of data annotations here , which should illustrate the concept.

+1


source







All Articles