简体   繁体   English

如何在WCF连接中忽略数据集架构

[英]How to ignore dataset schema in WCF connection

On the server side of my application I have a function like this: 在我的应用程序的服务器端,我具有如下功能:

public function GetDS as MyTypedDS
    Dim dsRetVal as new MyTypedDS
    'Make fantastic things with the dataset
    return dsRetVal 
end function

On the client side I call this function through a generated "service reference": 在客户端,我通过生成的“服务引用”调用此函数:

Dim ds as Reference1.MyTypedDS = myRefInst.GetDS

How can I disable schema serializaion of the typed dataset to reduce the traffic? 如何禁用类型化数据集的模式序列化以减少流量?

Is it enough to set the SchemaSerializationMode of 'dsRetVal' to ExcludeSchema before returning it? 在返回之前将“ dsRetVal”的SchemaSerializationMode设置为ExcludeSchema是否足够? Or is this option ignored by WCF? 还是WCF忽略了此选项?

Thank you 谢谢

Have you tried setting the RemotingFormat on the DataSet to SerializationFormat.Binary? 您是否尝试过将DataSet上的RemotingFormat设置为SerializationFormat.Binary? We use this extensively in .Net Remoting of DataSets (which, of course we only use when absolutely necessary) and it helps significantly with the performance. 我们在.Net数据集远程处理中广泛使用了此方法(当然,仅在绝对必要时才使用它),它对性能有很大帮助。

A couple of other options: 其他几个选择:

1) Binary serialize the DataSet and just transfer the ByteArray 1)二进制序列化数据集并只传输ByteArray

2) Serialize the DataSet into a string format (ie JSON) then zip the resultant string and transfer the zipped data. 2)将DataSet序列化为字符串格式(即JSON),然后压缩结果字符串并传输压缩的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM