Esempio n. 1
0
        private IFileDataAccess GetDataAccess(IDataAccessFileConfig config)
        {
            var fileInfo       = new FileInfo(config.FilePath);
            var fileDataAccess = _implementations.Where(d => d.SupportedFileExtension.Equals(fileInfo.Extension));

            return(fileDataAccess.First());
        }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 public JsonFileDataAccess([NotNull] IDataAccessFileConfig config)
 {
     _config = config ?? throw new ArgumentNullException(nameof(config));
 }