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

查看:17
本文介绍了是否在 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:

  • 数据集不符合 WSI 标准
  • 第 3 方软件似乎很少支持数据集

支持数据集阵营的一些论点:

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 文件 了解一些阅读内容.

See The XML Files for some reading.

此外,如果您正在开发新服务,请使用 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天全站免登陆