如何在 WCF 中返回 DataSet (xsd) [英] How to return DataSet (xsd) in WCF

查看:22
本文介绍了如何在 WCF 中返回 DataSet (xsd)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个库,它在某个方法上返回一个 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屋!

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