开发者

MVC 3: Setting Data Annotations on objects returned from SOAP Service

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜