private static void createDB(MappingClass map) { logger.Info("begin create database ..."); DatabaseType dbtype = DatabaseType.Access; IDatabaseChecker databaseChecker = DataFactory.GetDatabaseChecker(dbtype); databaseChecker.DatabaseType = dbtype; logger.Info("CheckDatabase"); databaseChecker.CheckDatabase(); logger.Info("CheckTable"); databaseChecker.CheckTable(map, DbConfig.DefaultDbName); logger.Info("GetTables"); map.TableList = databaseChecker.GetTables(); }
// ctor public MainViewModel( IDataImporterClass dataImporter, IDatabaseChecker databaseChecker, IDatabaseSeeder databaseSeeder, IDataLoader dataLoader) { _dataImporter = dataImporter; _databaseChecker = databaseChecker; _databaseSeeder = databaseSeeder; _dataLoader = dataLoader; ImportCommand = new RelayCommand(Import); LoadedCommand = new RelayCommand(Loaded); Games = new ObservableCollection<Game>(); }
private static void checkMultiDB(MappingClass map) { if (DbConfig.Instance.IsCheckDatabase == false) { logger.Info("skip check database"); return; } if (map.TableList == null) { map.TableList = new List <String>(); } if (DbConfig.Instance.ConnectionStringTable == null || DbConfig.Instance.ConnectionStringTable.Count == 0) { createDB(map); return; } logger.Info("begin check database..."); foreach (KeyValuePair <String, ConnectionString> kv in DbConfig.Instance.GetConnectionStringMap()) { String connectionString = kv.Value.StringContent; if (strUtil.IsNullOrEmpty(connectionString)) { throw new NotImplementedException(lang.get("exConnectionString") + ":" + kv.Key); } DatabaseType dbtype = kv.Value.DbType; IDatabaseChecker databaseChecker = DataFactory.GetDatabaseChecker(dbtype); databaseChecker.ConnectionString = connectionString; databaseChecker.DatabaseType = dbtype; logger.Info("CheckDatabase"); databaseChecker.CheckDatabase(); logger.Info("CheckTable"); databaseChecker.CheckTable(map, kv.Key); logger.Info("GetTables"); map.TableList.AddRange(databaseChecker.GetTables()); } logger.Info("end check database..."); }
public UnifiToSqlDatabaseExporter( IBlacklist blacklist, ICheckerCommandCreatorProvider checkerCommandCreatorProvider, IWriterCommandCreatorProvider writerCommandCreatorProvider, IDatabaseChecker checker, IDatabaseWriter writer, ICustomLogger customLogger, int batchSize) { _checkerCommandCreatorProvider = checkerCommandCreatorProvider; _writerCommandCreatorProvider = writerCommandCreatorProvider; _checker = checker; _writer = writer; _customLogger = customLogger; _batchSize = batchSize; _blacklist = blacklist; }