public static DataTableProducer FromCsvString(CompareBuilderOptions options, TextReader reader) { return(new DataTableProducer(options, new Action <DataTable>(dt => { DataTableSerializer.FromTextReader(dt, reader); }))); }
public void SaveTable(DataTable a, string fileName) { using (var writer = File.CreateText(fileName)) { DataTableSerializer.ToFile(a, writer); } }
public static DataTableProducer FromCsvFile(CompareBuilderOptions options) { return(new DataTableProducer(options, new Action <DataTable>(dt => { using (var reader = File.OpenText(options.Query)) { DataTableSerializer.FromTextReader(dt, reader); } }))); }
private DataTable CompareTables(DataTable a, DataTable b, string outputFileName) { var differentRows = a.AsEnumerable().Except(b.AsEnumerable(), DataRowComparer.Default); var diffTable = a.Clone(); foreach (var row in differentRows) { diffTable.Rows.Add(row.ItemArray); } logWriter.WriteLine("Identified {0} different rows comparing {1} to {2}", diffTable.Rows.Count, a.TableName, b.TableName); var aCols = DataTableSerializer.GetColumnsAsString(a); var bCols = DataTableSerializer.GetColumnsAsString(b); if (aCols != bCols) { logWriter.WriteLine(aCols); logWriter.WriteLine(bCols); logWriter.WriteLine("FATAL, column lists do not match"); } return(diffTable); }