Пример #1
0
 internal ElasticPool(string id, string name, string type, string location, IDictionary <string, string> tags, Sku sku, string kind, ElasticPoolState?state, DateTimeOffset?creationDate, long?maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool?zoneRedundant, ElasticPoolLicenseType?licenseType) : base(id, name, type, location, tags)
 {
     Sku                 = sku;
     Kind                = kind;
     State               = state;
     CreationDate        = creationDate;
     MaxSizeBytes        = maxSizeBytes;
     PerDatabaseSettings = perDatabaseSettings;
     ZoneRedundant       = zoneRedundant;
     LicenseType         = licenseType;
 }
        internal static ElasticPool DeserializeElasticPool(JsonElement element)
        {
            Optional <Sku>    sku      = default;
            Optional <string> kind     = default;
            string            location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <string>           id           = default;
            Optional <string>           name         = default;
            Optional <string>           type         = default;
            Optional <ElasticPoolState> state        = default;
            Optional <DateTimeOffset>   creationDate = default;
            Optional <long>             maxSizeBytes = default;
            Optional <ElasticPoolPerDatabaseSettings> perDatabaseSettings = default;
            Optional <bool> zoneRedundant = default;
            Optional <ElasticPoolLicenseType> licenseType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    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;
                }
                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;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("state"))
                        {
                            state = new ElasticPoolState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("creationDate"))
                        {
                            creationDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("maxSizeBytes"))
                        {
                            maxSizeBytes = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("perDatabaseSettings"))
                        {
                            perDatabaseSettings = ElasticPoolPerDatabaseSettings.DeserializeElasticPoolPerDatabaseSettings(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("zoneRedundant"))
                        {
                            zoneRedundant = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("licenseType"))
                        {
                            licenseType = new ElasticPoolLicenseType(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ElasticPool(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku.Value, kind.Value, Optional.ToNullable(state), Optional.ToNullable(creationDate), Optional.ToNullable(maxSizeBytes), perDatabaseSettings.Value, Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType)));
        }