【发布时间】:2010-11-12 05:09:07
【问题描述】:
我使用 binaryFormatter 序列化对象以进行发送。但是对于 ADO.NET 数据集,最佳实践是什么?我注意到二进制格式化程序在数据集的情况下被 xmlformatter 覆盖?如何减小尺寸并提高序列化速度?
【问题讨论】:
标签: .net serialization remoting
我使用 binaryFormatter 序列化对象以进行发送。但是对于 ADO.NET 数据集,最佳实践是什么?我注意到二进制格式化程序在数据集的情况下被 xmlformatter 覆盖?如何减小尺寸并提高序列化速度?
【问题讨论】:
标签: .net serialization remoting
您可以告诉它使用二进制模式而不是传统的 xml 模式:
myData.RemotingFormat = SerializationFormat.Binary;
您也可以尝试通过GZipStream 或DeflateStream 运行序列化程序,但这可能需要将其作为BLOB 发送而不是直接远程处理。
我最近也做了一些工作,着眼于通过 protobuf-net、here, including comparison metrics 推送 DataTable - 即使您不想要 protobuf-tweaks,数字数据也应该可以帮助您在 xml/binary 之间进行选择和香草/gzip/deflate。
【讨论】:
data.SchemaSerializationMode = SchemaSerializationMode.ExcludeSchema;
XmlWriteMode.IgnoreSchema 等。