-
-
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
- Multidimensional arrays
- Empty array is not the same as null and vice versa
- More compact
- Versioning between arrays and lists
- Better handling of collection subtypes
- You can control serialization separately for collection member and for its elements (and even for their inner elements if they are collections too)
- 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 |
---|---|
SerializableType | ProtoContract |
SerializeDerivedType | ProtoInclude |
(Partial)SerializableMember | Proto(Partial)Member |
SerializableMemberNested | - |
(Partial)NonSerializableMember | Proto(Partial)Ignore |
EnumSerializableValue | ProtoEnum |
(Before|After)(Des|S)erializationCallback | Proto(Before|After)(Des|S)erialization |
SurrogateConverter | ProtoConverter |
BinarySerializationBehavior | ProtoBehavior |
Attribute | Purpose |
---|---|
SerializableType | Marks a type and specifies its settings |
SerializeDerivedType | Specifies a derived type field number |
(Partial)SerializableMember | Marks a member and specifies its settings |
SerializableMemberNested | Specifies settings for collection item |
(Partial)NonSerializableMember | Excludes a member from serialization |
EnumSerializableValue | Specifies a field number for an enum value |
(Before|After)(Des|S)erializationCallback | Marks custom callbacks |
SurrogateConverter | Converter between a value and its surrogate |
BinarySerializationBehavior | 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 = ...)]
.
The legacy attributes are not affected by this.
And there are more ImplicitFields
options are available now.
- Serializers generate more correct and faster IL with Compile() or CompileInPlace()
- Using RunSharp instead of pure IL generation to make serializers compilation code easier to maintain
- Performance improvements
- Significant refactorings for better maintainability and extensibility
- More control of serialization and type-registration behavior
- For long data when output stream supports seeking doesn't keep things in internal buffer
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, Silverlight 4 and .NET 1.1 has been dropped.
vdproj installation project has been removed.