A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/msgpack/msgpack-cli/issues/171 below:

Unable to serialize standalone polymorphic type or collection · Issue #171 · msgpack/msgpack-cli · GitHub

I'm using the Redis MsgPack wrapper, but I've tried this separately using the raw MsgPack SDK as well.

I have a simple polymorphic type hierarchy e.g.

etc. etc., and I want to serialize a list of animals. The problem is that it appears that you need to enclose the list in a type e.g.

type Data = { Animals = ResizeArray<Animal> }

and then place an set of attributes on that property with all of the possible subclasses (or try one of the Runtime attributes).

There are several we face with this approach: -

  1. Every property on every type that has a List of Animal has to have the same attribute / attributes (or perhaps we need to create a custom List that subclasses List etc.). This means attributes all over our types etc.
  2. The bigger issue that is we need to create an enclosing type with a single property just to place the serialization polymorphism information. We should be able to store this information on the types themselves, and / or have a mechanism to do this lookup (similar to how JSON .Net works).

Have we missed something out here?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4