public void UpdateTableInfoMappings(long dataSourceId, List <TableInfo> tableInfos) { var datasource = GetSingleById(dataSourceId, false, false); try { var db = SqlDatabaseFactory.Create(Constants.ConnectionStrings.Core); // Delete existing deleteAllTableInfosAndColumnInfos(db, dataSourceId); // Connect to the database in the connection info var databaseConn = DatabaseFacadeFactory.Create(datasource.DataConnectionInfo); // Add schema foreach (TableInfo tableInfo in tableInfos) { // add table long tableId = createTableInfo(db, dataSourceId, tableInfo); // add columns bulkInsertColumnInfos(db, tableId, databaseConn.GetColumns(tableInfo.ObjectId)); } } catch (Exception ex) { throw new BasicDataException(string.Format("An unexpected error occurred while updating tables mappings. ERROR: {0}", ex.Message), ex); } }
/// <summary> /// Get tables from the actual data connection source /// </summary> /// <param name="info">The connection info to get the tables from.</param> /// <returns></returns> public List <TableInfo> GetTablesFromSource(DataConnectionInfo info) { var databaseFacade = DatabaseFacadeFactory.Create(info); return(databaseFacade.GetTables()); }
public bool TestConnection(DataConnectionInfo info) { var databaseFacade = DatabaseFacadeFactory.Create(info); return(databaseFacade.TestConnection()); }