Beispiel #1
0
        internal static DatasetResource DeserializeDatasetResource(JsonElement element)
        {
            Dataset properties = default;
            string  id         = default;
            string  name       = default;
            string  type       = default;
            string  etag       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    properties = Dataset.DeserializeDataset(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
            }
            return(new DatasetResource(id, name, type, etag, properties));
        }
        internal static DatasetDebugResource DeserializeDatasetDebugResource(JsonElement element)
        {
            Dataset           properties = default;
            Optional <string> name       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    properties = Dataset.DeserializeDataset(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
            }
            return(new DatasetDebugResource(name.Value, properties));
        }
Beispiel #3
0
        internal static DatasetResource DeserializeDatasetResource(JsonElement element)
        {
            Dataset           properties = default;
            Optional <string> etag       = default;
            Optional <string> id         = default;
            Optional <string> name       = default;
            Optional <string> type       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    properties = Dataset.DeserializeDataset(property.Value);
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
            }
            return(new DatasetResource(id.Value, name.Value, type.Value, etag.Value, properties));
        }