I have an MVC 3 web app that calls a SOAP web service to get 开发者_运维问答its data. It would be highly beneficial for me to apply data annotation attributes on returned object properties. Is it possible to do this or should I create a ViewModel for each corresponding object?
How could this be done?
From my own experience it is bad practice to use the objects returned from web services in Views - I tend to have a layer that maps my web service calls to View Models specific to that view
This can make it easier to use data in the view. The general rule is that 1 view model to a view
精彩评论