Beispiel #1
0
        /* use for source select command (need for IDataReader instance creation) */
        private string ConstructSelectCommand(Table table)
        {
            StringBuilder commnadTextBuilder = new StringBuilder("SELECT ");

            foreach (var column in table.Columns)
            {
                if (column.IsForImport)
                    commnadTextBuilder.AppendFormat("{0},", column.Name);
            }

            // removes last ',' sign
            commnadTextBuilder.Remove(commnadTextBuilder.Length - 1, 1);

            commnadTextBuilder.AppendFormat(" FROM dbo.[{0}]", table.Name);

            return commnadTextBuilder.ToString();
        }
Beispiel #2
0
        /** Creates list of Mapping class which contains mapping between columns
        *  (source and target)
        * TODO :
        *  1. Decide what gonna be source and target.
        */
        private IEnumerable<Mapping> ExtractColumnMappings(Table table)
        {
            var columnMappings = new List<Mapping>();
            foreach (var column in table.Columns)
            {
                if (column.IsForImport)
                {
                    columnMappings.Add(
                        new Mapping(column.Name, column.MappingColumnName));
                }
            }

            return columnMappings;
        }