In asp.net mvc, when I 开发者_StackOverflowhave my custom validations and validation messages using dataannotations in Model, does it not violate separation of concerns? ie: the custom validation might be related to a business logic, and error message might have to be validated using view specific parameters like localization?
What is your opinion and views on this. And what best way to have validations on data while having good separation of concerns?
I agree it does violate separate to some extent, but sometimes it's better not to be a 100% purist. Doing validation through annotations attached to your model will ensure consistency throughout all views that represent that model data.
精彩评论