如何在 WCF 中返回 DataSet (xsd)

编程入门 行业动态 更新时间:2024-10-20 03:39:35
本文介绍了如何在 WCF 中返回 DataSet (xsd)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个库,它在某个方法上返回一个 DataSet.我需要通过 WCF 公开此数据集,客户端应用程序将使用它作为报告生成器的数据源(准确地说是 DevExpress XtraReport).DataSet 包含大约 58 个 DataTable,其中包括一个包含报表配置的表.

I have a library that returns a DataSet on a certain method. I need to expose this DataSet over WCF, the client app will use this as a datasource for a report generator (DevExpress XtraReport to be exact). The DataSet contains about 58 DataTables, including a table containing configurations for the report.

如何通过 wcf 将该数据集传送到客户端 (ASP.NET MVC)

How can I get this dataset over wcf to the client (ASP.NET MVC)

当前代码

public ReponseData GetReportData (RequestData request){
 var reportData = library.GetReportData(request.Param1, reqest.Param2)   //returns DataSet

   var respone = new ResponseData {
        RequiredField = value, //requied for validation on the client
      //When I put DataSet here my wcf just breaks entirely 
      //.. what to do here to send over the DataSet??
   };
return response;

}

推荐答案

解决方案是使用 DataSet 的方法获取 XML 格式的数据,并将 XML 字符串而不是 DataSet 本身传递给服务.

The solution is use the DataSet’s methods to get the data in XML format and pass the XML string instead of the DataSet itself to the service.

PassDataSet(dsDataSet.GetXmlSchema(), dsDataSet.GetXml())

这篇关于如何在 WCF 中返回 DataSet (xsd)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 19:29:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1141116.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   WCF   xsd   DataSet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!