public override bool TryGetProvider(string connectionString, out IConnectionProvider provider, out Exception exception) { try { var _ = new SqlConnectionStringBuilder(connectionString); } catch (KeyNotFoundException ex) { exception = ex; provider = null; return(false); } catch (FormatException ex) { exception = ex; provider = null; return(false); } catch (ArgumentException ex) { exception = ex; provider = null; return(false); } provider = new SqlConnectionProvider(connectionString); exception = null; return(true); }
public override bool TryGetProvider(string connectionString, out IConnectionProvider provider, out Exception exception) { try { var _ = new SqlConnectionStringBuilder(connectionString); } catch (KeyNotFoundException ex) { exception = ex; provider = null; return false; } catch (FormatException ex) { exception = ex; provider = null; return false; } catch (ArgumentException ex) { exception = ex; provider = null; return false; } provider = new SqlConnectionProvider(connectionString); exception = null; return true; }
private IEnumerable<string> GetTheColumnsInTheTable(string tableName) { var connectionString = GetTheConnectionString(); var sqlConnectionProvider = new SqlConnectionProvider(connectionString); var sqlSchemaProvider = new SqlSchemaProvider(sqlConnectionProvider); var table = sqlSchemaProvider.GetTables().Single(x=>x.ActualName == tableName); return sqlSchemaProvider.GetColumns(table).Select(x => x.ActualName); }