System.Data.Common.DbConnectionOptions.ValidateKeyValuePair C# (CSharp) Метод

ValidateKeyValuePair() статический приватный Метод

static private ValidateKeyValuePair ( string keyword, string value ) : void
keyword string
value string
Результат void
        internal static void ValidateKeyValuePair(string keyword, string value)
        {
            if ((null == keyword) || !s_connectionStringValidKeyRegex.IsMatch(keyword))
            {
                throw ADP.InvalidKeyname(keyword);
            }
            if ((null != value) && !s_connectionStringValidValueRegex.IsMatch(value))
            {
                throw ADP.InvalidValue(keyword);
            }
        }
    }

Usage Example

Пример #1
0
 public virtual object this[string keyword]
 {
     get
     {
         ADP.CheckArgumentNull(keyword, "keyword");
         object value;
         if (CurrentValues.TryGetValue(keyword, out value))
         {
             return(value);
         }
         throw ADP.KeywordNotSupported(keyword);
     }
     set
     {
         ADP.CheckArgumentNull(keyword, "keyword");
         if (null != value)
         {
             string keyvalue = DbConnectionStringBuilderUtil.ConvertToString(value);
             DbConnectionOptions.ValidateKeyValuePair(keyword, keyvalue);
             // store keyword/value pair
             CurrentValues[keyword] = keyvalue;
         }
         _connectionString = null;
     }
 }
All Usage Examples Of System.Data.Common.DbConnectionOptions::ValidateKeyValuePair