Jeff LaFay
Jeff LaFay

Reputation: 13350

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?

Upvotes: 1

Views: 346

Answers (1)

stack72
stack72

Reputation: 8278

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

Upvotes: 3

Related Questions