Exemplo n.º 1
0
        public virtual void CopyValues(TableAttribute fromTable, TableAttribute toTable, IEnumerable <ColumnInfo> columns)
        {
            var select = new SelectExpression(new TableExpression(fromTable));
            var insert = new InsertExpression(new TableExpression(toTable))
            {
                Select = select
            };

            foreach (var column in columns)
            {
                if (column.IsIdentity)
                {
                    insert.IsIdentityInsertEnabled = true;
                }
                select.AddSelection(column.ToColumnExpression());
            }
            ExecuteNonQuery(insert);
        }