public SqlErrorStore(string connectionString, string connectionKey, int displayCount = DefaultDisplayCount, int rollupSeconds = DefaultRollupSeconds) : base(rollupSeconds) { displayCount = Math.Min(displayCount, MaximumDisplayCount); if (connectionString.IsNullOrEmpty()) { var cs = SqlConnections.GetConnectionString(connectionKey); this.connectionString = cs.ConnectionString; this.providerName = cs.ProviderName; isSqlServer = cs.Dialect.ServerType.StartsWith("SqlServer", StringComparison.OrdinalIgnoreCase); } else { this.connectionString = connectionString; this.providerName = connectionKey; isSqlServer = providerName.IndexOf("SqlClient", StringComparison.OrdinalIgnoreCase) >= 0; } // check that provider name is valid SqlConnections.GetFactory(this.providerName); if (this.connectionString.IsNullOrEmpty()) { throw new ArgumentOutOfRangeException("settings", "A connection string or connection string name must be specified when using a SQL error store"); } }