通过 WCF 服务返回数据集时出现问题 [英] Issue while returning Dataset through WCF Service

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

问题描述

我在通过 WCF 服务 (WSHttpBinding) 返回数据集时遇到了一个奇怪的问题.我正在解释下面的情景:

I have been facing a strange problem while returning dataset through WCF service (WSHttpBinding). I'm explaining the senario below:

  1. 我有一个Businesslayer,里面是一个'Demo'文件夹,里面有一个类文件demo.cs,里面有一个特定表的变量.

  1. I have a Businesslayer, inside is a folder 'Demo', which contains a class file demo.cs, which carries the variable for a particular table.

接下来,我有一个Datalayer,里面是一个'Demo'文件夹,里面还有一个类文件demo.cs,里面包含了所有数据库相关的函数和方法.

Next, i have a Datalayer, inside is a folder 'Demo', also contains a class file demo.cs, which contains all the database related functions and methods.

接下来,我创建了一个 WCF 服务,其中包含一个接口 (Idemo.cs),该接口是 [ServiceContract] 定义的,并且所有方法的签名都使用OperationContract"定义.

Next, I have created a WCF service, which contains a interface (Idemo.cs), which is [ServiceContract] defined and all the signatures for the methods are defined, using 'OperationContract'.

在 WCFService.cs 类中,我拥有所有必须从 GUI 调用的方法.

In the WCFService.cs class, i have all the methods which have to be called from GUI.

最后,我使用svcutil"在应用程序中为服务创建了代理.

Lastly, i created the proxy for the service in the Application using 'svcutil'.

问题/问题:

所有其他服务都返回列表对象,它们运行良好,但在演示案例中,它返回数据集.在数据集的情况下,创建的服务(在 appCode 中)与其他列表返回类非常不同.所有其他服务都使用诸如Businesslayer.demo.demolist objdemo"之类的结构调用但在这种情况下,此结构显示错误并排除结构'demo objdemo'

All the other services return list object, which are working perfectly, but in demo case, it return dataset. In dataset case, the service created(in appCode) is very different from the other list returning classes. All the other service are called using strucure like 'Businesslayer.demo.demolist objdemo' but in this case this structure shows an error and excepts structure 'demo objdemo'

我现在不知道,我是否能够解释我的担忧,但如果有人可以向我发送具有相同 senario 的演示应用程序,通过 WCF 服务返回数据集,那将非常有帮助.

I dont now, whether i m able to explain my concern, but it will be very helpful if anyone can send me the demo application with same senario, returning dataset through WCF service.

推荐答案

  1. 不要从服务操作返回数据集.

了解原因:http://www.hanselman.com/blog/ReturningDataSetsFromWebServicesIsTheSpawnOfSatanAndRepresentsAllThatIsTrulyEvilInTheWorld.aspx

这篇关于通过 WCF 服务返回数据集时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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