Fast and flexible C# serialization framework

Antmicro’s Migrant is a fast and flexible serialization framework usable for undecorated classes, written in C# and usable with both the .NET and Mono runtimes. Its aim is to provide an easy way to serialize complex graphs of objects, with minimal programming effort.

Migrant was originally created to answer the needs of state saving and loading feature of the Renode framework, but quickly expanded into an independent project with more use cases and features.

Many of the available serialization frameworks do not consider complex graph relations between objects. It’s a common situation that serializing and deserializing two objects A and B referencing the same object C leaves you with two identical copies of C, one referenced by A and one referenced by B. Migrant takes such scenarios into account, preserving the identity of references, without further code decoration. Thanks to this, a programmer is relieved of implementing complex consistency mechanisms for the system and the resulting binary form is even smaller.

Migrant’s ease of use does not prohibit the programmer from controlling the serialization behaviour in more complex scenarios. It is possible to hide some fields of a class, to deserialize objects using their custom constructors and to add hooks to the class code that will execute before or after (de)serialization. With little effort it is possible for the programmer to reimplement (de)serialization patterns for specific types.

The project is MIT-licensed and developed on GitHub.

Learn more