Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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));
        }