Inheritance: IQueryExecutor
Example #1
0
 public CsvDataImporter(ILogger logger, QueryExecutor queryExecutor, string csvDirectory, char delimiter)
 {
     _logger = logger;
     _queryExecutor = queryExecutor;
     _csvDirectory = csvDirectory;
     _delimiter = delimiter;
 }
Example #2
0
        private void ExportIfSelected(nDumpOptions nDumpOptions, ILogger logger, DataPlan dataPlan)
        {
            if (!nDumpOptions.Export) return;

            try
            {
                var queryExecutor = new QueryExecutor(nDumpOptions.SourceConnectionString);
                ISelectionFilteringStrategy filteringStrategy =
                    nDumpOptions.ApplyFilters
                        ? (ISelectionFilteringStrategy) new UseFilterIfPresentStrategy(queryExecutor, logger)
                        : new IgnoreFilterStrategy();

                var exporter = new SqlDataExporter(logger, filteringStrategy,
                                                   new CsvGenerator(logger, filteringStrategy, queryExecutor,
                                                                    nDumpOptions.CsvDirectory, nDumpOptions.Delimiter));
                exporter.ExportToCsv(dataPlan.SetupScripts, dataPlan.DataSelects);
            }
            catch (Exception ex)
            {
                throw new nDumpApplicationException("Export To Csv Failed.", ex);
            }
        }