接收DTO从ASP.NET Web服务 [英] Receiving a DTO From an ASP.NET Web Service

查看:343
本文介绍了接收DTO从ASP.NET Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行ASP.NET,而我访问返回Person对象,其中人是由外国公司定义的一些DTO的List外国ASMX Web服务,那么什么是为我处理结果的最佳方式?我要创造我自己的DTO对象调用的人接受他们的Person对象,我让他们给我的类定义?人们如何正常面对呢?

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 best way for me to handle the result? Should I create my own DTO object called Person to receive their Person object, should I have them send me class definitions? How do people normally deal with this?

推荐答案

定义你自己的DTO和地图异物(从代理类或某事),你自己的。只需要你需要什么。这给你一个抽象层从WebService,如果它都没有改变。

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.$c$cplex.com/ 可能是有帮助的映射。

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

这篇关于接收DTO从ASP.NET Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆