public async Task LoadTablesAsync() { LoadConnection = true; var connectionBuilder = ParentTreeBase.ConnectionBuilder; var dteCore = new DTECore(connectionBuilder.ConnectionType, connectionBuilder.ConnectionString, new DTESettings().Settings); Tables.Clear(); var tables = await dteCore.GetTablesAsync(DatabaseName); foreach (var tableName in tables) { Tables.Add(new Table() { TableName = tableName, ParentTreeBase = ParentTreeBase, DataBaseName = DatabaseName }); } LoadConnection = false; }
public async Task LoadDatabasesAsync() { try { Databases.Clear(); LoadConnection = true; var dteCore = new DTECore(_connectionBuilder.ConnectionType, _connectionBuilder.ConnectionString, new DTESettings().Settings); var databases = await dteCore.GetDatabasesAsync(); foreach (var dbName in databases) { var db = new Database { DatabaseName = dbName, ParentTreeBase = this, Tables = new ObservableCollection <Table>() }; var tables = await dteCore.GetTablesAsync(dbName); foreach (var tableName in tables) { db.Tables.Add(new Table() { TableName = tableName, ParentTreeBase = this, DataBaseName = db.DatabaseName }); } Databases.Add(db); } LoadConnection = false; } catch (Exception ex) { LoadConnection = false; throw ex; } }