neuecc/ZeroFormatter

Fluent APIs

aloisdeniel opened this issue · 1 comments

It would be great to have fluent APIs to describe models.

I have something like this in mind :

ZeroFormatter.Types.Union<Animal>()
             .Index(0, x => x.Color)
             .Index(1, x => x.Size)
             .UnionKey(x => x.Name)
             .WithChild<Cat>()
             .WithChild<Dog>();

ZeroFormatter.Types.Register<Cat>()
             .Index(2, x => x.Milk);

I suggest this because I would like to offer a base union class into a library, but currently all joined types must be declared into the root class attribute.

DynamicUnion seems to be a good solution for that. :)