Programming in asp.net-mvc: Do model metadata providers in ASP.NET MVC 3 support dynamic metadata? on newest questions tagged asp.net-mvc – Stack Overflow
I’m trying to implement some custom model metadata in ASP.NET MVC 3. I can’t use data annotation attributes since some of the metadata could change based on configured values, so I need a solution that will let me set the metadata on every request. I’ve been reading about custom model metadata providers, but I can’t find anything about support for dynamic metadata scenarios.
Does the MVC framework cache the metadata from the model metadata provider, or will the CreateMetadata method be called on every request? Is a custom model metadata provider a good solution for dynamic metadata, or should I just put it in the view model?
Edit: This isn’t necessarily validation metadata I’m talking about, so I’m not looking for a validation specific solution. It could just be metadata to be displayed or used by the view (in HTML 5 data attributes for example).
Programming in asp.net-mvc: programming-in-asp-net-mvc