I have the following architecture of my application: http://clip2net.com/clip/m50879/1303228845-clip-15kb.png
The Model contains a set of POCO objects which should be validated on the web and the services sides. Also, I have additional ViewModel layer which is being used only on the web side. The ViewModel layer contains the most of validation logic开发者_如何学C which is the same as the Model validation logic...
The question is: What is the best approach to avoid copy-paste of the Model validation logic to the ViewModel validation logic?
Maybe this is of interest: "How to: Validate Model Data Using DataAnnotations Attributes" http://msdn.microsoft.com/en-us/library/ee256141(VS.100).aspx
精彩评论