ProtoInclude adds unwanted dependencies

那年仲夏 提交于 2019-12-14 01:03:48

问题


I just replaced .NET serialization with protocol buffers in a distributed cache application and the results are really impressive. The only thing I do not like is the fact that I need to add dependencies between a base message class and its children which creates a circular dependency. Is there an alternative to tagging base class with ProtoInclude?


回答1:


In v1; [ProtoInclude] is the only way to support inheritance.

In v2, you can use MetaType's .AddSubType(...) method to achieve the same thing, without requiring your base-type to know about the derived type(s).



来源:https://stackoverflow.com/questions/1231789/protoinclude-adds-unwanted-dependencies

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!