要在Web服务中返回数据集吗? [英] To return a dataset in a web service or not?

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

问题描述

从.NET Web服务返回(或 NOT 返回数据集)是否有最佳做法?一个营地说,我们应该促进互操作性,并使用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:


  • 数据集不符合WSI标准

  • 数据集似乎很少被第三方软件支持

在pro-dataset阵营中有一些参数:

Some arguments in the pro-dataset camp:


  • 它们非常方便快捷地在Visual Studio中构建。

  • 我们(我的公司)只在.NET中开发,所以互操作性不是一个问题

  • 客户端的数据集具有易于使用的优点

推荐答案

使用数据集?我会说一千次不。它们不能与其他工具包互操作(正如你所提到的)。当然,你现在唯一的消费者现在是.NET,但事情可以快速变化,这是很好的准备。

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天全站免登陆