private IFileDataAccess GetDataAccess(IDataAccessFileConfig config) { var fileInfo = new FileInfo(config.FilePath); var fileDataAccess = _implementations.Where(d => d.SupportedFileExtension.Equals(fileInfo.Extension)); return(fileDataAccess.First()); }
public FileDataAcessFacade([NotNull] IDataAccessFileConfig config, [NotNull] IEnumerable <IFileDataAccess> implementations, [NotNull] ILogger <FileDataAcessFacade> logger) { _config = config ?? throw new ArgumentNullException(nameof(config)); _implementations = implementations ?? throw new ArgumentNullException(nameof(implementations)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _fileDataAccess = GetDataAccess(config); _data = _fileDataAccess.ReadFromFile(); }
public JsonFileDataAccess([NotNull] IDataAccessFileConfig config) { _config = config ?? throw new ArgumentNullException(nameof(config)); }