문제

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

도움이 되었습니까?

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top