Question

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...

Was it helpful?

OTHER TIPS

You could overload the validation runner to swap out error messages with ones from a database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top