コード例 #1
0
 internal DatastoreProperties(DatastoreContents contents, bool?hasBeenValidated, bool?isDefault, LinkedInfo linkedInfo, IDictionary <string, string> properties, string description, IDictionary <string, string> tags)
 {
     Contents         = contents;
     HasBeenValidated = hasBeenValidated;
     IsDefault        = isDefault;
     LinkedInfo       = linkedInfo;
     Properties       = properties;
     Description      = description;
     Tags             = tags;
 }
コード例 #2
0
        internal static DatastoreProperties DeserializeDatastoreProperties(JsonElement element)
        {
            DatastoreContents     contents         = default;
            Optional <bool>       hasBeenValidated = default;
            Optional <bool>       isDefault        = default;
            Optional <LinkedInfo> linkedInfo       = default;
            Optional <IDictionary <string, string> > properties = default;
            Optional <string> description = default;
            Optional <IDictionary <string, string> > tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("contents"))
                {
                    contents = DatastoreContents.DeserializeDatastoreContents(property.Value);
                    continue;
                }
                if (property.NameEquals("hasBeenValidated"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hasBeenValidated = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("isDefault"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isDefault = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("linkedInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    linkedInfo = LinkedInfo.DeserializeLinkedInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    properties = dictionary;
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
            }
            return(new DatastoreProperties(contents, Optional.ToNullable(hasBeenValidated), Optional.ToNullable(isDefault), linkedInfo.Value, Optional.ToDictionary(properties), description.Value, Optional.ToDictionary(tags)));
        }