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

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

问题描述

通过WCF服务(WSHttpBinding)返回数据集时,我一直面临一个奇怪的问题。我在下面解释该senario:

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.

接下来,我有一个数据层,里面是文件夹 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. 不要从服务操作中返回数据集

  1. Do not return a DataSet from a service operation.

要查看原因: http://www.hanselman.com/blog/ReturningDataSetsFromWebServicesIsTheSpawnOfSatanAndRepresentsAllThatIsTrulyEvilInTheWorld.aspx

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

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