Customizing data annotation attributes for ASP.NET MVC -


i customize @ runtime attributes mvc sees on view model property. far know, mvc relies internally on type descriptors enumerate attributes. there way hook type descriptor somewhere return custom list of attributes property?

is there way hook type descriptor somewhere return custom list of attributes property?

it depends. if want override data annotations used metadata provider write own custom modelmetadataprovider , replace default 1 (dataannotationsmodelmetadataprovider). allows have custom metadata provider given type , return information @ runtime.

if on other hand doing validation, bit out of luck. more flexibility recommend using fluentvalidation.net instead of data annotations.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -