Adding EF initialization
This commit is contained in:
@@ -7,19 +7,22 @@ namespace LeafWeb.Core.Parsers
|
||||
{
|
||||
public class CsvParserBase : IDisposable
|
||||
{
|
||||
protected readonly FileSystemInfo CsvFile;
|
||||
private readonly StreamReader _reader;
|
||||
protected readonly CsvReader CsvReader;
|
||||
|
||||
protected CsvParserBase(FileSystemInfo csvFile)
|
||||
{
|
||||
CsvFile = csvFile;
|
||||
_reader = OpenCsv(csvFile);
|
||||
var csvConfiguration = new CsvConfiguration { HasHeaderRecord = false, IgnoreBlankLines = false, IgnoreReadingExceptions = true};
|
||||
CsvReader = new CsvReader(_reader, csvConfiguration);
|
||||
}
|
||||
|
||||
internal static StreamReader OpenCsv(FileSystemInfo csvFile)
|
||||
{
|
||||
if (!csvFile.Exists)
|
||||
throw new FileNotFoundException($"Cannot find file '{csvFile.Name}'");
|
||||
|
||||
_reader = File.OpenText(csvFile.FullName);
|
||||
var csvConfiguration = new CsvConfiguration { HasHeaderRecord = false, IgnoreBlankLines = false, IgnoreReadingExceptions = true};
|
||||
CsvReader = new CsvReader(_reader, csvConfiguration);
|
||||
return File.OpenText(csvFile.FullName);
|
||||
}
|
||||
|
||||
protected string[] GetNextCsvRowValues()
|
||||
|
||||
Reference in New Issue
Block a user