[英]Is it possible to serialize complex object with Protocol Buffers C# (ProtoBuf-net)
Is it possible to serialize complex object with Protocol Buffers C# (ProtoBuf-net) without using Protocontract and proto files ? 是否可以在不使用Protocontract和proto文件的情况下使用Protocol Buffers C#(ProtoBuf-net)序列化复杂对象?
[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). 我试图使用ProtoContract,但即使这样我也无法序列化对象(它是一个LLBLGen ORM对象)。
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; Re .proto文件; 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. 那些(并且一直是) 完全可选的protobuf-net,因为我认识到很多情况下代码优先方法(或对现有模型的序列化改造)是有用的。 Three is a code-generator if you choose to use .proto, of course. 如果您选择使用.proto,则三是代码生成器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.