Beispiel #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}");
            }
        }
 public DataBaseServiceFactory(IFileWorkerFactory fileWorkerFactory,
                               ITableServiceFactory tableServiceFactory,
                               IDbWriterFactory dbWriterFactory)
 {
     _fileWorkerFactory   = fileWorkerFactory;
     _tableServiceFactory = tableServiceFactory;
     _dbWriterFactory     = dbWriterFactory;
 }
Beispiel #3
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;
        }