private void LoadTables() { throw new NotImplementedException("Loading"); //Model.ExecutionItems.Clear(); // TODO: Also clear caches Model.IsQueryRunning = true; TableEntityCollection tables = null; Action a = new Action(() => { using (var tda = new TableEntityDataAccess(Model.ConnectionString)) { tables = tda.GetAllTablesAndColumns(); } DispatcherSupplier.CurrentDispatcher.Invoke( DispatcherPriority.Normal, (Action) delegate { Model.Tables = tables; Model.SelectedTable = Model.Tables.FirstOrDefault(); Model.SelectedColumn = Model.SelectedTable.Columns.FirstOrDefault(); Model.SetTablesView(); //Model.SelectedExecutionItem = Model.ExecutionItems.FirstOrDefault(); Model.IsQueryRunning = false; }); }); a.BeginInvoke(null, null); }
public TableEntityCollection GetAllTablesAndColumns() { TableEntityCollection tables = new TableEntityCollection(GetMany(ALL_Tables_And_All_Columns_SQL_Query, CreateTableAndColumnsEntity)); return(tables); }
public OldApplicationModel() { Tables = new TableEntityCollection(); //WorkFlowManager = new WorkflowManager(); //ExecutionItems = new ExecutionItemCollection(); //SelectedExecutionItem = ExecutionItems.FirstOrDefault(); ConnectionString = SQLDataProducerSettings.Default.ConnectionString; // TODO: Move plugin folder to some other folder. Configure where it is? Or hardcode _availablePlugins = PluginLoader.LoadPluginsFromFolder(Environment.CurrentDirectory); _executionItemsWithWarningsSource = new CollectionViewSource { Source = ExecutionItems }; ExecutionItemsWithWarningsView = _executionItemsWithWarningsSource.View; ExecutionItemsWithWarningsView.Filter = new Predicate <object>(obj => { ExecutionNode t = obj as ExecutionNode; if (t != null) { return(t.HasWarning); } return(true); }); }
public List <TableEntity> GetTreeStructureWithTableAsLeaf(TableEntity tableAsLeafOfTree, TableEntityCollection tablesAvailAble) { string s = string.Format(TABLES_IN_HIERARCHY_WITH_TABLE_AS_LEAF, tableAsLeafOfTree.TableSchema, tableAsLeafOfTree.TableName); Func <SqlDataReader, TableEntity> getTreeStructure = reader => { var tableInTree = new { TableSchema = reader.GetString(reader.GetOrdinal("Table_Schema")), TableName = reader.GetString(reader.GetOrdinal("Table_Name")) }; return(tablesAvailAble.Where(x => x.TableName == tableInTree.TableName && x.TableSchema == tableInTree.TableSchema ).FirstOrDefault()); }; return(GetMany(s, getTreeStructure)); }