internal static void CheckArrayParameter( ref string[] param, bool checkForNull, bool checkIfEmpty, bool checkForCommas, int maxSize, string paramName) { if (param == null) { throw new ArgumentNullException(paramName); } if (param.Length < 1) { throw new ArgumentException(MsgManager.GetMsg(ErrRes.PROVIDER_PARAMETER_ARRAY_EMPTY, paramName)); } Hashtable hashtable = new Hashtable(param.Length); for (int index = param.Length - 1; index >= 0; --index) { Util.CheckParameter(ref param[index], checkForNull, checkIfEmpty, checkForCommas, maxSize, paramName + "[ " + index.ToString((IFormatProvider)CultureInfo.InvariantCulture) + " ]"); if (hashtable.Contains((object)param[index])) { throw new ArgumentException(MsgManager.GetMsg(ErrRes.PROVIDER_PARAMETER_DUPLICATE_ARRAY_ELEMENT, paramName)); } hashtable.Add((object)param[index], (object)param[index]); } }
internal static void CheckParameter( ref string param, bool checkForNull, bool checkIfEmpty, bool checkForCommas, int maxSize, string paramName) { if (param == null) { if (checkForNull) { throw new ArgumentNullException(paramName); } } else { if (checkIfEmpty && param.Length < 1) { throw new ArgumentException(MsgManager.GetMsg(ErrRes.PROVIDER_PARAMETER_CANNOT_BE_EMPTY, paramName)); } if (maxSize > 0 && param.Length > maxSize) { throw new ArgumentException(MsgManager.GetMsg(ErrRes.PROVIDER_PARAMETER_TOO_LONG, paramName, maxSize.ToString((IFormatProvider)CultureInfo.InvariantCulture))); } if (checkForCommas && param.Contains(",")) { throw new ArgumentException(MsgManager.GetMsg(ErrRes.PROVIDER_PARAMETER_CANNOT_CONTAIN_COMMA, paramName)); } } }
internal OracleConnectionHolder(string connectionString) { try { this.m_Connection = new OracleConnection(connectionString); } catch (ArgumentException ex) { throw new ArgumentException(MsgManager.GetMsg(ErrRes.PROVIDER_ODP_CONNECTION_STRING_ERROR), nameof(connectionString), (Exception)ex); } }
internal static void CheckForUnrecognizedAttribute(NameValueCollection config) { if (config.Count <= 0) { return; } string key = config.GetKey(0); if (!string.IsNullOrEmpty(key)) { throw new ProviderException(MsgManager.GetMsg(ErrRes.PROVIDER_UNRECOGNIZED_ATTRIBUTE, key)); } }
internal static string ReadAndVerifyApplicationName(NameValueCollection config) { string defaultAppName = config["applicationName"]; if (string.IsNullOrEmpty(defaultAppName)) { defaultAppName = Util.GetDefaultAppName(); } if (defaultAppName.Length > 256) { throw new ProviderException(MsgManager.GetMsg(ErrRes.PROVIDER_APPLICATION_NAME_TOO_LONG)); } return(defaultAppName); }
internal static string ReadConnectionString(NameValueCollection config) { string index = config["connectionStringName"]; if (string.IsNullOrEmpty(index)) { throw new ProviderException(MsgManager.GetMsg(ErrRes.PROVIDER_CONNECTION_NAME_NOT_SPECIFIED)); } ConnectionStringSettings connectionString = (WebConfigurationManager.GetSection("connectionStrings") as ConnectionStringsSection).ConnectionStrings[index]; string str = string.Empty; if (connectionString != null) { str = connectionString.ConnectionString; } if (string.IsNullOrEmpty(str)) { throw new ProviderException(MsgManager.GetMsg(ErrRes.PROVIDER_CONNECTION_STRING_NOT_FOUND, index)); } return(str); }