public static DataTableProducer FromCsvString(CompareBuilderOptions options, TextReader reader)
 {
     return(new DataTableProducer(options, new Action <DataTable>(dt =>
     {
         DataTableSerializer.FromTextReader(dt, reader);
     })));
 }
 public static DataTableProducer FromQuery(CompareBuilderOptions options)
 {
     return(new DataTableProducer(options, new Action <DataTable>(dt =>
     {
         Fill(dt, options.Query, options.ConnectionString);
     })));
 }
 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);
         }
     })));
 }
 public static DataTableProducer FromDataTable(CompareBuilderOptions options)
 {
     return(new DataTableProducer(options, new Action <DataTable>(dt =>
     {
         foreach (DataColumn col in options.DataTable.Columns)
         {
             dt.Columns.Add(new DataColumn(col.ColumnName));
         }
         foreach (DataRow row in options.DataTable.Rows)
         {
             var nRow = dt.NewRow();
             nRow.ItemArray = row.ItemArray;
             dt.Rows.Add(nRow);
         }
         //dt = options.DataTable;
     })));
 }
            public static DataTableProducer Create(CompareBuilderOptions options)
            {
                switch (options.InputType)
                {
                case InputTypes.Query:
                    return(DataTableProducer.FromQuery(options));

                case InputTypes.CsvFile:
                    return(DataTableProducer.FromCsvFile(options));

                case InputTypes.DataTable:
                    return(DataTableProducer.FromDataTable(options));

                default:
                    throw new ArgumentException("Unimplemented argument for InputType");
                }
            }
 private DataTableProducer(CompareBuilderOptions options, Action <DataTable> func)
 {
     this.Options  = options;
     this.Callback = func;
 }