如何protobuf的-CSHARP端口和protobuf网之间进行选择 [英] How to choose between protobuf-csharp-port and protobuf-net
问题描述
我最近不得不寻找最初是由谷歌developped议定书缓冲器库的C#移植。你猜怎么着,我发现拥有两个项目都是由这里两个非常知名的人士:的protobuf-CSHARP端口一>,写的乔恩斯基特并的 protobuf网,由马克Gravell 写的。我的问题很简单:我必须选择哪一个?
I've recently had to look for a C# porting of the Protocol Buffers library originally developped by Google. And guess what, I found two projects owned both by two very well known persons here: protobuf-csharp-port, written by Jon Skeet and protobuf-net, written by Marc Gravell. My question is simple: which one do I have to choose ?
我很喜欢马克的解决方案,因为它在我看来,更接近C#philisophy(例如,你可以将属性添加到现有类的属性),它看起来像它可以支持.NET内置类型如的System.Guid。
I quite like Marc's solution as it seems to me closer to C# philisophy (for instance, you can just add attributes to the properties of existing class) and it looks like it can support .NET built-in types such as System.Guid.
我相信他们两个人是真正伟大的项目,但什么是你的oppinion?
I am sure both of them are really great projects but what's your oppinion?
推荐答案
我同意乔恩的点;如果你是编码在多个环境,那么他的版本给你一个类似的API其他核心的实现。 protobuf网是更类似于如何大多数.NET序列化来实现的,所以比较熟悉(IMO)到.NET开发者。随着乔恩笔记 - 原始的二进制输出的应的是相同的,所以你可以用不同的API,如果你以后需要重新实现
I agree with Jon's points; if you are coding over multiple environments, then his version gives you a similar API to the other "core" implementations. protobuf-net is much more similar to how most of the .NET serializers are implemented, so is more familiar (IMO) to .NET devs. And as Jon notes - the raw binary output should be identical so you can re-implement with a different API if you need to later.
几点重新protobuf网是的具体的此实现:
Some points re protobuf-net that are specific to this implementation:
- 适用于的现有类型(不只是产生来自.proto类型)
- 在之类的东西WCF和memcached的
- 作品可以用来实现
ISerializable的
为现有类型 - 支持继承*和序列化回调方法
- 支持常见的模式,如
ShouldSerialize [名]
- 与现有的装饰类型(适用
XmlType将
/的XmlElement
或DataContract
/数据成员
) - 这意味着(例如)LINQ-到SQL车型序列外的开箱(只要序列在DBML启用) - 在V2,适用于POCO类型没有任何属性
- 在V2,工作在.NET 1.1(不知道这是一个巨大的卖点)和大多数其他框架(包括MonoTouch的 - !耶)
- 的可能的(尚未实施)V2可支持全图*序列(不只是树序列化)
- works with existing types (not just generated types from .proto)
- works under things like WCF and memcached
- can be used to implement
ISerializable
for existing types - supports inheritance* and serialization callback methods
- supports common patterns such as
ShouldSerialize[name]
- works with existing decorated types (
XmlType
/XmlElement
orDataContract
/DataMember
) - meaning (for example) that LINQ-to-SQL models serialize out-of-the-box (as long as serialization is enabled in the DBML) - in v2, works for POCO types without any attributes
- in v2, works in .NET 1.1 (not sure this is a huge selling feature) and most other frameworks (including monotouch - yay!)
- possibly (not yet implemented) v2 might support full-graph* serialization (not just tree serialization)
(* =这些功能使用100%有效protobuf的二进制文件,但可能很难从其他语言消费)
(*=these features use 100% valid protobuf binary, but which might be hard to consume from other languages)
这篇关于如何protobuf的-CSHARP端口和protobuf网之间进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!