views:

230

answers:

1

For example I store information about display column in database and I don't want to use DisplayColumnAttribute for define this. What can I do to create DataAnnotations info in runtime?

A: 

Probably you need to use "DynamicData Buddy Classes" feature. It allows holding validation metadata in a separate class. So you can create your custom generator that will generate that "buddy classes" from your database.

Update: Check this blogpost i found today when encountered yet another limitation of DataAnnotations attributes mechanism.

UserControl