/// <summary>
 /// Gets or sets a connection option.
 /// </summary>
 /// <param name="keyword">The keyword that identifies the connection option to modify.</param>
 public override object this[string keyword]
 {
     get
     {
         MySqlConnectionStringOption opt = GetOption(keyword);
         if (opt.XGetter != null)
         {
             return(opt.XGetter(this, opt));
         }
         else if (opt.Getter != null)
         {
             return(opt.Getter(this, opt));
         }
         else
         {
             throw new ArgumentException(Resources.KeywordNotSupported, keyword);
         }
     }
     set
     {
         MySqlConnectionStringOption opt = GetOption(keyword);
         if (opt.XSetter != null)
         {
             opt.XSetter(this, opt, value);
         }
         else if (opt.Setter != null)
         {
             opt.Setter(this, opt, value);
         }
         else
         {
             throw new ArgumentException(Resources.KeywordNotSupported, keyword);
         }
     }
 }
        internal override MySqlConnectionStringOption GetOption(string key)
        {
            MySqlConnectionStringOption option = Options.Get(key);

            if (option == null)
            {
                throw new ArgumentException(Resources.KeywordNotSupported, key);
            }
            else
            {
                return(option);
            }
        }
        public override bool Remove(string keyword)
        {
            bool removed = false;

            lock (this) { removed = base.Remove(keyword); }
            if (!removed)
            {
                return(false);
            }
            MySqlConnectionStringOption option = GetOption(keyword);

            lock (this)
            {
                values[option.Keyword] = option.DefaultValue;
            }
            return(true);
        }
        internal override void SetInternalValue(string keyword, object value)
        {
            MySqlConnectionStringOption option = GetOption(keyword);

            option.ValidateValue(ref value, keyword, true);

            // remove all related keywords
            option.Clean(this);

            if (value != null)
            {
                lock (this)
                {
                    // set value for the given keyword
                    values[option.Keyword] = value;
                    base[keyword]          = value;
                }
            }
        }
        public override bool ContainsKey(string keyword)
        {
            MySqlConnectionStringOption option = Options.Get(keyword);

            return(option != null);
        }