private List <TableInformationModel> GetTablesFromRepository(DatabaseInfo dbInfo) { if (dbInfo.DatabaseType == DatabaseType.Npgsql) { return(EnvDteHelper.GetNpgsqlTableNames(dbInfo.ConnectionString)); } if (dbInfo.DatabaseType == DatabaseType.Mysql) { return(EnvDteHelper.GetMysqlTableNames(dbInfo.ConnectionString)); } using (var repository = RepositoryHelper.CreateRepository(dbInfo)) { var allPks = repository.GetAllPrimaryKeys(); var tableList = repository.GetAllTableNamesForExclusion(); var tables = new List <TableInformationModel>(); foreach (var table in tableList) { var hasPrimaryKey = allPks.Any(m => m.TableName == table); tables.Add(new TableInformationModel(table, hasPrimaryKey)); } return(tables); } }