Receiving a DTO From an ASP.NET Web Service

后端 未结 3 1637
情书的邮戳
情书的邮戳 2021-01-28 07:10

If I run ASP.NET, and I am accessing a foreign asmx web service that returns a List of Person objects, where Person is some DTO defined by the foreign company, then what is the

3条回答
  •  心在旅途
    2021-01-28 07:46

    Define your own DTO and map the foreign object (from a proxy class or something) to your own. Take only what you need. This gives you a layer of abstraction from the webservice if it ever changes.

    http://automapper.codeplex.com/ might be helpful for the mappings.

提交回复
热议问题