c# - Dynamically change data annotation in dynamic data project -


i have come across scenerio customize dataannotations in dynamic data web application. scenerio:

[display(name="dispname")] public string dname{get;set;} 

instead of hardcoding name="dispname" display dataannotation, want fetch value database , fit int name attribute. like:

[display(name=somevaluefromdb)]     public string dname{get;set;} 

is there way show name attribute of display dataannotation database instead of hardcoding value?

also how can change scaffoldcolumn(true/false) based on table values?

can using t4 template ?

thanks in advance.

generally speaking no, attributes compiled , become part of cil metadata. investigate thread goes detail on topic. is possible modify attribute of property @ runtime?

personally think should looking @ way pass label front-end can flexible. eg model contains labels , values.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -