protobuf的数据串行器 [英] Protobuf data serializer

查看:122
本文介绍了protobuf的数据串行器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这dataserializer是伟大的表现。但我一直被陷在datacolumns有System.Object的数据类型为使串行抛出异常:无法序列类型的数据列'System.Object的

this dataserializer is great for performance. but I keep getting stuck on datacolumns that has datatype of System.Object causing the serializer to throw an exception:Cannot serialize data column of type 'System.Object'.

有周围没有任何办法?

is there any way around it?

推荐答案

在protobuf的格式设计,以适应场景中的数据是predictable到接收器,并且不适合对象的情况非常好,但是,根据数据布局的几件事情是可能的:

The protobuf format is designed to suit scenarios where the data is predictable to the receiver, and does not suit "object" scenarios very well, however, depending on the data layout a few things are possible:

  • 如果对象的数据是某种形式的嵌套的消息,那么你可以标记的成员作为DynamicType =真作为ProtoMemberAttribute装饰的一部分;这然后包括一些元数据,但是作为一个protobuf网特定扩展。这不会是系统之间非常便携
  • 如果对象的数据确实是一个极少数已知类型的,一般的东西如int /日期/浮动等则有再presenting一些方法,继承(非通用底座式,多特异性T亚型)。同样,这将不会是平台之间非常便携

我可以说明要么如果我理解模型等等。

I can illustrate either if I understand the model more.

这篇关于protobuf的数据串行器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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