コード例 #1
0
        public DataBaseService(string name, string rootPath, long fileSize, SupportedSources source,
                               IFileWorkerFactory fileWorkerFactory,
                               ITableServiceFactory tableServiceFactory,
                               IDbWriterFactory dbWriterFactory)
        {
            _tableServiceFactory = tableServiceFactory;
            _dbWriterFactory     = dbWriterFactory;

            var regex = new Regex(".*"); //valid

            if (regex.IsMatch(rootPath))
            {
                DataBase = new DataBase
                {
                    Name     = name,
                    Settings = new Settings {
                        RootPath = rootPath, FileSize = fileSize, DefaultSource = source
                    }
                };
                _fileWorker = fileWorkerFactory.GetFileWorker(DataBase);

                _fileWorker.UpdateDataBaseFile();
            }
            else
            {
                throw new ArgumentException($"Incorrect path: {rootPath}");
            }
        }
コード例 #2
0
 public FileHelper(Settings.Settings setting,
                   IDbWriterFactory dbWriterFactory,
                   IDataBaseServiceFactory dataBaseServiceFactory)
 {
     _setting                = setting;
     _dbWriterFactory        = dbWriterFactory;
     _dataBaseServiceFactory = dataBaseServiceFactory;
 }
コード例 #3
0
 public DataBaseServiceFactory(IFileWorkerFactory fileWorkerFactory,
                               ITableServiceFactory tableServiceFactory,
                               IDbWriterFactory dbWriterFactory)
 {
     _fileWorkerFactory   = fileWorkerFactory;
     _tableServiceFactory = tableServiceFactory;
     _dbWriterFactory     = dbWriterFactory;
 }
コード例 #4
0
        public FileWorker(DataBase dataBase,
                          IDbWriterFactory dbWriterFactory,
                          ISourceFactory sourceFactory)
        {
            _sourceFactory = sourceFactory;

            DataBase  = dataBase;
            _dbWriter = dbWriterFactory.GetDbWriter(dataBase.Settings.DefaultSource);
        }
コード例 #5
0
        public DataBaseService(string path,
                               IFileWorkerFactory fileWorkerFactory,
                               ITableServiceFactory tableServiceFactory,
                               IDbWriterFactory dbWriterFactory)
        {
            _tableServiceFactory = tableServiceFactory;
            _dbWriterFactory     = dbWriterFactory;

            SupportedSources source = ResolvePath(path);

            _fileWorker = fileWorkerFactory.GetFileWorker(new DataBase {
                Settings = new Settings {
                    DefaultSource = source
                }
            });
            DataBase = _fileWorker.GetDataBaseFromFile(path);

            _fileWorker.DataBase = DataBase;
        }
コード例 #6
0
 public FileWorkerFactory(IDbWriterFactory dbWriterFactory,
                          ISourceFactory sourceFactory)
 {
     _dbWriterFactory = dbWriterFactory;
     _sourceFactory   = sourceFactory;
 }