-
Notifications
You must be signed in to change notification settings - Fork 3
Comparison with protobuf net and migration
In short, protobuf-net serializes data but AqlaSerializer is intended to serialize objects. What the difference? Data serializers don't care much about language runtime specifics like references, inheritance, etc. In contrast, an object serializer should take such things into account.
Are you tired of endless ProtoExceptions like Internal error; a key mismatch occurred
? Think AqlaSerializer is a solution.
For Aqla and third party attributes reference tracking and null support are enabled by default where appropriate.
- Nested collections are supported.
- Empty array is not the same as null and vice versa.
- Always packed for better output size.
- Possible versioning between arrays and lists.
- For collections subtype information is written.
- Settings can be specified separately per collection member and nested value.
- You may reference both protobuf-net dll and AqlaSerializer because attributes have different names.
- AqlaSerializer supports protobuf-net attributes.
- To control AqlaSerializer features use its new attributes.
To allow users reference both protobuf-net dll and AqlaSerializer it contains new attributes in AqlaSerializer namespace. I want to make the migration as much easy as I can so AqlaSerializer supports all the protobuf-net legacy attributes. You don't need to remove protobuf-net reference and can use both AqlaSerializer and protobuf-net in the same project. Legacy attributes are supported when you reference protobuf-net.dll. Mind that some new features may be enabled only for new Aqla attributes to ensure legacy behavior for protobuf-net members.
AqlaSerializer.dll | protobuf-net.dll | Purpose |
---|---|---|
SerializableType | ProtoContract | Marks type and specifies its settings |
SerializeDerivedType | ProtoInclude | Specifies derived type field number |
(Partial)SerializableMember | Proto(Partial)Member | Marks a member and specifies its settings |
SerializableMemberNested | - | Specifies settings for collection item |
(Partial)NonSerializableMember | Proto(Partial)Ignore | Excludes a member from serialization |
EnumSerializableValue | ProtoEnum | Specifies a field number for an enum value |
(Before|After)(Des|S)erializationCallback | Proto(Before|After)(Des|S)erialization | Marks custom callbacks |
SurrogateConverter | ProtoConverter | Converter between a value and its surrogate |
BinarySerializationBehavior | ProtoBehavior | WCF |
Attributes behavior is controlled by a current auto-add behavior.
AqlaSerializer new attributes have improved behavior which you need to take into account when migrating: SerializableType
assumes ImplicitFields
behavior by default which means all properties of type are considered serializable automatically (even with no explicit SerializableMember
attribute). You can change this with SerializableType.ImplicitFields
property.
The legacy attributes are not affected by this.
And there are more ImplicitFields
options are available now.
As AqlaSerializer is basically a fork of protobuf-net, it's checked against the same tests. The behavior should be nearly the same for legacy attributes as it passes practically all protobuf-net tests which are not related to its write format.
Be aware that you can't directly serialize objects with protobuf-net and than deserialize them with AqlaSerializer and opposite unless you use a compatibility mode.
See also Protocol Buffers support page.
Everything is the same as in protobuf-net but support for CF 2, CF 3.5, Windows Phone 7 and .NET 1.1 has been dropped.
vdproj installation project has been removed.