Beispiel #1
0
        public static JsonSerializer CreateSerializer()
        {
            var d = new FieldTypeDiscriminatorMapper();

            foreach (var t in ContentFieldManager.Default.GetAllOptionTypes())
            {
                d.AddType(t);
            }

            return(JsonSerializer.Create(new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.Auto,
                SerializationBinder = new TypeNameSerializationBinder(d),
                Formatting = Formatting.Indented
            }));
        }
Beispiel #2
0
 public TypeNameSerializationBinder(FieldTypeDiscriminatorMapper discriminator)
 {
     Discriminator = discriminator;
 }