Ejemplo n.º 1
0
        public override void RunNameTransformation(INameTransformation transform)
        {
            base.RunNameTransformation(transform);
            var table = (TableInfo)NewObject;

            table.RunNameTransformation(transform);
        }
Ejemplo n.º 2
0
 public void RunNameTransformation(INameTransformation nameTransform)
 {
     PrimaryKeyTable   = nameTransform.RenameObject(PrimaryKeyTable, "table");
     PrimaryKeyColumns = new List <IColumnReference>(PrimaryKeyColumns.MapEach(
                                                         c => (IColumnReference) new ColumnReference(nameTransform.RenameColumn(PrimaryKeyTable, c.ColumnName), c.SpecificData)
                                                         ));
 }
Ejemplo n.º 3
0
 public void RunNameTransformation(INameTransformation nameTransform)
 {
     FullName = nameTransform.RenameObject(FullName, "table");
     foreach (ColumnStructure col in Columns)
     {
         col.ColumnName = nameTransform.RenameColumn(FullName, col.ColumnName);
     }
     foreach (Constraint cnt in Constraints)
     {
         var col = cnt as ColumnsConstraint;
         if (col != null)
         {
             col.Columns = new List <IColumnReference>(col.Columns.MapEach(
                                                           c => (IColumnReference) new ColumnReference(nameTransform.RenameColumn(FullName, c.ColumnName), c.SpecificData)
                                                           ));
         }
         //cnt.Table = FullName;
         cnt.Name = nameTransform.RenameConstraint(cnt);
         var fk = cnt as ForeignKey;
         if (fk != null)
         {
             fk.RunNameTransformation(nameTransform);
         }
     }
 }
Ejemplo n.º 4
0
 public void RunNameTransformation(INameTransformation transform)
 {
     foreach (var op in Operations)
     {
         op.RunNameTransformation(transform);
     }
 }
Ejemplo n.º 5
0
        public override void RunNameTransformation(INameTransformation transform)
        {
            base.RunNameTransformation(transform);
            var fk = NewObject as ForeignKey;

            if (fk != null)
            {
                fk.RunNameTransformation(transform);
            }
        }
Ejemplo n.º 6
0
 public void RunNameTransformation(INameTransformation nameTransform)
 {
     FullName = nameTransform.RenameObject(FullName, "table");
     foreach (var col in Columns)
     {
         col.Name = nameTransform.RenameColumn(FullName, col.Name);
     }
     foreach (var cnt in Constraints)
     {
         cnt.ConstraintName = nameTransform.RenameConstraint(cnt);
     }
 }
Ejemplo n.º 7
0
        //public void AutoFillRefs()
        //{
        //    foreach (TableStructure tbl in Tables)
        //    {
        //        tbl._ReferencedFrom.Clear();
        //    }
        //    foreach (TableStructure src in Tables)
        //    {
        //        foreach (IForeignKey fk in src.GetConstraints<IForeignKey>())
        //        {
        //            try
        //            {
        //                TableStructure dst = (TableStructure)Tables[fk.PrimaryKeyTable];
        //                dst._ReferencedFrom.Add(new ForeignKey(fk));
        //            }
        //            catch
        //            {
        //                continue;
        //            }
        //        }
        //    }
        //}

        public void RunNameTransformation(INameTransformation nameTransform)
        {
            foreach (TableStructure tbl in Tables)
            {
                NameWithSchema newname = nameTransform.RenameObject(tbl.FullName, "table");;
                foreach (ColumnStructure col in tbl.Columns)
                {
                    string newcolname = nameTransform.RenameColumn(tbl.FullName, col.ColumnName);
                    col.ColumnName = newcolname;
                    if (col.Domain != null)
                    {
                        col.Domain = nameTransform.RenameObject(col.Domain, "domain");
                    }
                }
                tbl.FullName = nameTransform.RenameObject(tbl.FullName, "table");
            }
            foreach (DomainStructure dom in Domains)
            {
                dom.FullName = nameTransform.RenameObject(dom.FullName, "domain");
            }
            foreach (string objtype in SpecificObjects.Keys)
            {
                foreach (SpecificObjectStructure spec in SpecificObjects[objtype])
                {
                    NameWithSchema newname = nameTransform.RenameObject(spec.ObjectName, objtype);
                    spec.ObjectName = newname;
                    if (spec.RelatedTable != null)
                    {
                        spec.RelatedTable = nameTransform.RenameObject(spec.RelatedTable, "table");
                    }
                    if (spec.DependsOn != null)
                    {
                        foreach (var dep in spec.DependsOn)
                        {
                            dep.Name = nameTransform.RenameObject(dep.Name, dep.ObjectType);
                        }
                    }
                }
            }
            foreach (TableStructure tbl in Tables)
            {
                foreach (Constraint cnt in tbl.Constraints)
                {
                    NameWithSchema oldtable = cnt.Table.FullName;
                    //cnt.Table = nameTransform.RenameObject(cnt.Table, "table");
                    var col = cnt as ColumnsConstraint;
                    if (col != null)
                    {
                        for (int i = 0; i < col.Columns.Count; i++)
                        {
                            try
                            {
                                col.Columns[i] = new ColumnReference(nameTransform.RenameColumn(oldtable, col.Columns[i].ColumnName), col.Columns[i].SpecificData);
                            }
                            catch (KeyNotFoundException)
                            {
                                Logging.Warning("column {0}.{1} referenced but not exists", oldtable, col.Columns[i]);
                            }
                        }
                    }
                    var fk = cnt as ForeignKey;
                    if (fk != null)
                    {
                        for (int i = 0; i < fk.PrimaryKeyColumns.Count; i++)
                        {
                            try
                            {
                                fk.PrimaryKeyColumns[i] = new ColumnReference(
                                    nameTransform.RenameColumn(fk.PrimaryKeyTable, fk.PrimaryKeyColumns[i].ColumnName),
                                    fk.PrimaryKeyColumns[i].SpecificData);
                            }
                            catch (KeyNotFoundException)
                            {
                                Logging.Warning("column {0}.{1} referenced but not exists", fk.PrimaryKeyTable, fk.PrimaryKeyColumns[i]);
                            }
                        }
                        try
                        {
                            fk.PrimaryKeyTable = nameTransform.RenameObject(fk.PrimaryKeyTable, "table");
                        }
                        catch (KeyNotFoundException)
                        {
                            Logging.Warning("table {0} referenced but not exists", fk.PrimaryKeyTable);
                        }
                    }
                    cnt.Name = nameTransform.RenameConstraint(cnt);
                }
            }
        }
Ejemplo n.º 8
0
 public void RunNameTransformation(INameTransformation transform)
 {
     foreach (var op in Operations)
     {
         op.RunNameTransformation(transform);
     }
 }
Ejemplo n.º 9
0
 public void RunNameTransformation(INameTransformation nameTransform)
 {
     FullName = nameTransform.RenameObject(FullName, "table");
     foreach (var col in Columns)
     {
         col.Name = nameTransform.RenameColumn(FullName, col.Name);
     }
     foreach (var cnt in Constraints)
     {
         cnt.ConstraintName = nameTransform.RenameConstraint(cnt);
     }
 }
Ejemplo n.º 10
0
 public virtual void RunNameTransformation(INameTransformation transform)
 {
 }
Ejemplo n.º 11
0
 public void RunNameTransformation(INameTransformation transform)
 {
     Reload();
     DbStruct.RunNameTransformation(transform);
     SaveToFile();
 }
Ejemplo n.º 12
0
 public override void RunNameTransformation(INameTransformation transform)
 {
     base.RunNameTransformation(transform);
     var table = (TableInfo)NewObject;
     table.RunNameTransformation(transform);
 }
Ejemplo n.º 13
0
 public override void RunNameTransformation(INameTransformation transform)
 {
     base.RunNameTransformation(transform);
     var fk = NewObject as ForeignKeyInfo;
     //if (fk != null) fk.RunNameTransformation(transform);
 }
Ejemplo n.º 14
0
 public virtual void RunNameTransformation(INameTransformation transform)
 {
 }