/** Creates list of Mapping class which contains mapping between columns * (source and target) * TODO : * 1. Decide what gonna be source and target. */ protected 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; }
public DataTable GetData(Table table) { throw new NotImplementedException(); }
/* use for source select command (need for IDataReader instance creation) */ protected 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(); }