Пример #1
0
        GremlinDatabase IOperationSource <GremlinDatabase> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = GremlinDatabaseData.DeserializeGremlinDatabaseData(document.RootElement);

            return(new GremlinDatabase(_armClient, data));
        }
        internal static GremlinDatabaseListResult DeserializeGremlinDatabaseListResult(JsonElement element)
        {
            Optional <IReadOnlyList <GremlinDatabaseData> > value = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <GremlinDatabaseData> array = new List <GremlinDatabaseData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(GremlinDatabaseData.DeserializeGremlinDatabaseData(item));
                    }
                    value = array;
                    continue;
                }
            }
            return(new GremlinDatabaseListResult(Optional.ToList(value)));
        }