public IEnumerable <Record> ReadAllRecordsFrom(ExcelSource source) { using (var stream = File.Open(source.FilePath, FileMode.Open, FileAccess.Read)) { using (var reader = ExcelReaderFactory.CreateReader(stream)) { return(ReadRecordsFromReader(reader)); } } }
public IEnumerable <Record> ReadAllRecordsFrom(ExcelSource source) { try { return(decoratedReader.ReadAllRecordsFrom(source)); } catch (IOException) { throw new FileOpenedByAnotherProcessException(); } catch (ExcelDataReader.Exceptions.HeaderException) { throw new NotAnExcelFileException(); } }