コード例 #1
0
        ///GENMHASH:83E91F2084686A41CC7FEC4FD3AABFFB:7CD5D685622F1E16B5C558CB56626C01
        public SqlServerAutomaticTuningImpl WithAutomaticTuningOption(string tuningOptionName, AutomaticTuningOptionModeDesired desiredState)
        {
            if (this.Inner.Options == null)
            {
                this.Inner.Options = new Dictionary <string, AutomaticTuningServerOptions>();
            }
            AutomaticTuningServerOptions item = this.Inner.Options[tuningOptionName];

            if (item == null)
            {
                item = new AutomaticTuningServerOptions();
            }
            item.DesiredState = desiredState;
            this.Inner.Options[tuningOptionName] = item;
            return(this);
        }
コード例 #2
0
 ///GENMHASH:956E7E258ED13C6526B661525EF63263:D8912A8B3BCC1193AE7D0262B922E2BB
 public SqlServerAutomaticTuningImpl WithAutomaticTuningOptions(IDictionary <string, Models.AutomaticTuningOptionModeDesired> tuningOptions)
 {
     if (tuningOptions != null)
     {
         this.Inner.Options = new Dictionary <string, AutomaticTuningServerOptions>();
         foreach (var optionItem in tuningOptions)
         {
             var item = new AutomaticTuningServerOptions();
             item.DesiredState = optionItem.Value;
             this.Inner.Options[optionItem.Key] = item;
         }
     }
     else
     {
         this.Inner.Options = null;
     }
     return(this);
 }
コード例 #3
0
        internal static ServerAutomaticTuningData DeserializeServerAutomaticTuningData(JsonElement element)
        {
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <AutomaticTuningServerMode> desiredState = default;
            Optional <AutomaticTuningServerMode> actualState  = default;
            Optional <IDictionary <string, AutomaticTuningServerOptions> > options = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("desiredState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            desiredState = property0.Value.GetString().ToAutomaticTuningServerMode();
                            continue;
                        }
                        if (property0.NameEquals("actualState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            actualState = property0.Value.GetString().ToAutomaticTuningServerMode();
                            continue;
                        }
                        if (property0.NameEquals("options"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            Dictionary <string, AutomaticTuningServerOptions> dictionary = new Dictionary <string, AutomaticTuningServerOptions>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, AutomaticTuningServerOptions.DeserializeAutomaticTuningServerOptions(property1.Value));
                            }
                            options = dictionary;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ServerAutomaticTuningData(id, name, type, systemData, Optional.ToNullable(desiredState), Optional.ToNullable(actualState), Optional.ToDictionary(options)));
        }