要返回一个数据集的Web服务或没有? [英] To return a dataset in a web service or not?

查看:99
本文介绍了要返回一个数据集的Web服务或没有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个方面的最佳实践,从.NET Web服务返回(或不可以返回数据集)?一个阵营说,我们应该促进互操作性和使用XML模式来定义Web服务的有效载荷,对方阵营说,我们应该返回的数据集,因为它是简单的在Visual Studio中,并得到更快速地完成工作。

Is there a best practice in regards to returning (or NOT returning datasets) from .NET web services? One camp says that we should promote interoperability and use XML schemas to define the web service payload, the other camp says we should return datasets because it's straightforward in Visual Studio and get's the job done more quickly.

在反数据集阵营的一些参数:

Some arguments in the anti-dataset camp:

  • 在数据集不符合节水灌溉
  • 数据集似乎很少被第三方软件的支持

在亲数据集阵营的一些参数:

Some arguments in the pro-dataset camp:

  • 他们都非常方便,快速地建立在Visual Studio中。
  • 我们(我公司)只开发在.NET这样的互操作性不是问题
  • 在客户端数据集具有优势,易于使用

推荐答案

使用数据集?我想说一千个不。它们不能互操作与其他工具包(你提到)。当然,你唯一的消费者,现在是.NET,但事情可能迅速改变,这是很好的为prepared。

Use Datasets? I would say a thousand times no. They are not interoperable with other toolkits (as you mention). Sure, your only consumers right now are .NET but things can change quickly and it's nice to be prepared.

请参阅的XML文件一些阅读。

另外,如果您正在开发新的服务,使用WCF写出来。然后,不过你想要的,你可以将它们公开。如果服务和消费是内部的,都是.NET,那么你可以使用TCP获得更好的性能结合。再后来就当别人想与您的服务进行通信,您可以添加一个新的Web服务绑定,所以他们的Java应用程序(例如)可以与您的服务进行互操作。请参见选择合适的WCF绑定< /一>一个方便的流程图。

Also, if you are developing new services, write them using WCF. Then you can expose them however you want. If the service and consumer are internal and both are .NET then you can use the TCP binding for better performance. Then later on when someone else wants to communicate with your service you can add a new web service binding so their Java app (for example) can interoperate with your service. See Choosing the right WCF binding for a handy flowchart.

这篇关于要返回一个数据集的Web服务或没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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