Esempio n. 1
0
        public override object Clone()
        {
            if (!this.EntitySelected)
                return null;
            Database db = new Database();
            db.Name = this.Name;
            db.Parent = this.Parent;
            db.EntitySelected = this.EntitySelected;
            db.Id = this.Id;
            
            foreach (Table table in this.Tables)
            {
                Table newTable = table.Clone() as Table;
                if (newTable != null)
                {
                    newTable.Parent = db;
                    db.Tables.Add(newTable);
                }
            }

            foreach (View view in this.Views)
            {
                View newView = view.Clone() as View;
                if (newView != null)
                {
                    newView.Parent = db;
                    db.Views.Add(newView);
                }
            }

            foreach (Function view in this.Functions)
            {
                Function newFunction = view.Clone() as Function;
                if (newFunction != null)
                {
                    newFunction.Parent = db;
                    db.Functions.Add(newFunction);
                }
            }

            foreach (StoredProcedure sp in this.StoredProcedures)
            {
                StoredProcedure newSp = sp.Clone() as StoredProcedure;
                if (newSp != null)
                {
                    newSp.Parent = db;
                    db.StoredProcedures.Add(newSp);
                }
            }
            return db;

        }
Esempio n. 2
0
 public Table(string name,string schema,Database parentDatabase)
 {
     this.Name = name;
     this.Schema = schema;
     this.ParentDatabase = parentDatabase;
 }
Esempio n. 3
0
        private void OrderTablesBasedOnDependencies(Database db,ref List<Table> tables)
        {
            if (db.Tables.Count == tables.Count)
                return;
            
            foreach(Table t in db.Tables)
            {
                Table check = Table.GetByNameandSchema(tables, t.Name, t.Schema);
                if(check == null)
                {
                    if( t.ParentRelationShips.Count == 0)
                    {
                        tables.Add(t);
                        
                        
                    }
                }
            }

            foreach (Table t in db.Tables)
            {
                Table check = Table.GetByNameandSchema(tables, t.Name, t.Schema);
                if (check == null)
                {
                    tables.Add(t);
                }
            }
            db.Tables = tables;
        }
 public abstract void GetFunctions(Database database);
 public abstract void GetStoredProcedures(Database database);
 public abstract void GetViews(Database database);
 public abstract void GetColumns(Database database);
 public abstract void GetTables(Database database);