Ejemplo n.º 1
0
 internal static void FixIndexReferences(IIndex indexToCopyInto, IIndex indexToCopyFrom)
 {
     // Fix Column references
     foreach (var col in indexToCopyFrom.Columns)
     {
         indexToCopyInto.AddColumn(col.Name);
     }
 }
Ejemplo n.º 2
0
        protected override void RunOperationInternal()
        {
            var newTable = Object.Clone();

            if (newTable.IsView)
            {
                Database.AddView(newTable);
            }
            else
            {
                Database.AddTable(newTable);
            }

            foreach (IColumn col in Object.Columns)
            {
                newTable.AddColumn(col.Clone());
            }

            foreach (IKey key in Object.Keys)
            {
                IKey newKey = newTable.AddKey(key.Clone());
                newKey.Parent = newTable;

                foreach (var column in key.Columns)
                {
                    newKey.AddColumn(column.Name);
                }
            }

            foreach (IIndex index in Object.Indexes)
            {
                IIndex newIndex = newTable.AddIndex(index.Clone());
                newIndex.Parent = newTable;

                foreach (var column in index.Columns)
                {
                    newIndex.AddColumn(column.Name);
                }
            }
        }