public static string GetModelFileName(TableDefinition tableDefinition) { return tableDefinition.TableName; }
public static string GetMappingFileName(TableDefinition tableDefinition) { return tableDefinition.TableName + "Mapping"; }
private async Task<List<SelectedTable>> GetTables(string connectionString) { var result = new List<SelectedTable>(); using (var connection = new SqlConnection(connectionString)) { await connection.OpenAsync(); var command = new SqlCommand("SELECT TABLE_SCHEMA,TABLE_NAME FROM information_schema.tables", connection); var reader = await command.ExecuteReaderAsync(); while(reader.Read()) { var record = new SelectedTable { IsSelected = true }; var tableDefinition = new TableDefinition { TableSchema = reader.GetString(0), TableName = reader.GetString(1), ColumnDefinitions = new List<ColumnDefinition>() }; await GetColumnDefinitions(tableDefinition.TableName, connectionString, tableDefinition.ColumnDefinitions); record.TableDefinition = tableDefinition; result.Add(record); } reader.Close(); } return result; }