Esempio n. 1
0
        internal static AutoNCrossValidations DeserializeAutoNCrossValidations(JsonElement element)
        {
            NCrossValidationsMode mode = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("mode"))
                {
                    mode = new NCrossValidationsMode(property.Value.GetString());
                    continue;
                }
            }
            return(new AutoNCrossValidations(mode));
        }
Esempio n. 2
0
        internal static CustomNCrossValidations DeserializeCustomNCrossValidations(JsonElement element)
        {
            int value = default;
            NCrossValidationsMode mode = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    value = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("mode"))
                {
                    mode = new NCrossValidationsMode(property.Value.GetString());
                    continue;
                }
            }
            return(new CustomNCrossValidations(mode, value));
        }
Esempio n. 3
0
        internal static NCrossValidations DeserializeNCrossValidations(JsonElement element)
        {
            if (element.TryGetProperty("mode", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "Auto": return(AutoNCrossValidations.DeserializeAutoNCrossValidations(element));

                case "Custom": return(CustomNCrossValidations.DeserializeCustomNCrossValidations(element));
                }
            }
            NCrossValidationsMode mode = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("mode"))
                {
                    mode = new NCrossValidationsMode(property.Value.GetString());
                    continue;
                }
            }
            return(new NCrossValidations(mode));
        }