是否可以使用 Protocol Buffers C# (ProtoBuf-net) 序列化复杂对象
是否可以在不使用 Protocontract 和 proto 文件的情况下使用 Protocol Buffers C# (ProtoBuf-net) 序列化复杂对象?
[ProtoBuf.ProtoContract(ImplicitFields = ProtoBuf.ImplicitFields.AllPublic)]
我尝试使用 ProtoContract 但即使这样我也无法序列化对象(它是 LLBLGen ORM 对象)。
Is it possible to serialize complex object with Protocol Buffers C# (ProtoBuf-net) without using Protocontract and proto files ?
[ProtoBuf.ProtoContract(ImplicitFields = ProtoBuf.ImplicitFields.AllPublic)]
I have tried to use the ProtoContract but even then I can't serialize object (It is a LLBLGen ORM object).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的;这里有多种选择;
我可以提供更多建议,但有许多选项可供选择;告诉我哪一个最合适,我可以添加更多细节。
重新 .proto 文件;对于 protobuf-net,这些都是(并且一直)完全可选,因为我认识到在很多情况下代码优先方法(或对现有模型的序列化改造)是有用的。当然,如果您选择使用 .proto,则三个是代码生成器。
Yes; there are various options here;
I can advise more, but there are a number of options presented; tell me which is/are most appropriate and I can add more detail.
Re .proto files; those are (and have always been) entirely optional with protobuf-net, as I recognise that there are a lot of cases where a code-first approach (or retrofit of serialization to an existing model) is useful. Three is a code-generator if you choose to use .proto, of course.