protobuf的数据串行器串行、数据、protobuf

2023-09-06 18:31:25 作者:相逢即是缘分

这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.