I have a requirement that the validation error messages that are passed to my view come from the database.
I want to use data annotation on my model but the error message key in validation attributes can only be a string or a constant.
I'm open to other solutions for validation but I need to pull the error messages from the database.
Are there any other ellegent solutions for validation were the error message is not a string? Right now I am thinking about using T4 to generate a constants file...
My specific problem can be solved by using the ASP.NET MVC2 Metadata and Model Validation Providers.
Here are the articles that got me started:
http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-2-modelmetadata.html
http://dotnetslackers.com/articles/aspnet/customizing-asp-net-mvc-2-metadata-and-validation.aspx
http://haacked.com/archive/2009/10/01/asp.net-mvc-preview-2-released.aspx