public void addTable(DB.Table table)
        {
            //initialize
            int nbrOfTable = this.tables.Count;

            this._tables.Add(table as Table);
        }
        public DB.Table getCorrespondingTable(DB.Table externalTable)
        {
            var _externalTable = (Table)externalTable;
            //first check for exact match
            var correspondingTable = this.tables.FirstOrDefault(x => x.name == externalTable.name);

            if (correspondingTable == null)
            {
                //if no exact match found then get the one that is derived from the same logical classes
                foreach (Table table in this.tables)
                {
                    bool match = false;
                    //each logical class of the external table should be equal to the logical class of this table
                    foreach (var logicalClass in table.logicalClasses)
                    {
                        if (_externalTable.logicalClasses.Any(x => x.Equals(logicalClass)))
                        {
                            match = true;
                        }
                        else
                        {
                            match = false;
                        }
                    }
                    if (match)
                    {
                        //found it;
                        correspondingTable = table;
                        break;
                    }
                }
            }
            return(correspondingTable);
        }
 public void removeTable(DB.Table table)
 {
     this._tables.Remove((Table)table);
 }
예제 #4
0
        private List <Column> getCorrespondingColumn(List <DB.Column> originalColumns, DB.Table newTable)
        {
            var newColumns = new List <Column>();

            foreach (Column originalcolumn in originalColumns)
            {
                Column newColumn = newTable.columns.FirstOrDefault(x => x.name == originalcolumn.name) as Column;
                if (newColumn != null)
                {
                    newColumns.Add(newColumn);
                }
            }
            return(newColumns);
        }