internal static ListKey DeserializeListKey(JsonElement element)
        {
            Optional <string>    key = default;
            ExtraInformationKind extraInformationKind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("key"))
                {
                    key = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extraInformationKind"))
                {
                    extraInformationKind = new ExtraInformationKind(property.Value.GetString());
                    continue;
                }
            }
            return(new ListKey(extraInformationKind, key.Value));
        }
        internal static EntitySubtype DeserializeEntitySubtype(JsonElement element)
        {
            Optional <string>    value = default;
            ExtraInformationKind extraInformationKind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    value = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extraInformationKind"))
                {
                    extraInformationKind = new ExtraInformationKind(property.Value.GetString());
                    continue;
                }
            }
            return(new EntitySubtype(extraInformationKind, value.Value));
        }
Esempio n. 3
0
        internal static BaseExtraInformation DeserializeBaseExtraInformation(JsonElement element)
        {
            if (element.TryGetProperty("extraInformationKind", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "EntitySubtype": return(EntitySubtype.DeserializeEntitySubtype(element));

                case "ListKey": return(ListKey.DeserializeListKey(element));
                }
            }
            ExtraInformationKind extraInformationKind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extraInformationKind"))
                {
                    extraInformationKind = new ExtraInformationKind(property.Value.GetString());
                    continue;
                }
            }
            return(new BaseExtraInformation(extraInformationKind));
        }
 public static ListKey ListKey(ExtraInformationKind extraInformationKind = default, string key = null)
 {
     return(new ListKey(extraInformationKind, key));
 }
 public static EntitySubtype EntitySubtype(ExtraInformationKind extraInformationKind = default, string value = null)
 {
     return(new EntitySubtype(extraInformationKind, value));
 }