public DataCollectorQueryExecutor(SqlConnection sqlConnection) { _sqlConnection = sqlConnection; getBaseInstanceInfo = new GetBaseInstanceInfo(_sqlConnection); getListofDatabases = new GetListofDatabases(_sqlConnection); repositoryAccess = new RepositoryAccess(); }
public void ExecuteDatabaseQueries() { List <Task> databaseTasks = new List <Task>(); _dbList.ForEach((db) => databaseTasks.Add(Task.Factory.StartNew(() => { RepositoryAccess repositoryAccess = new RepositoryAccess(); db.InstanceId = _instanceId; int dbId = repositoryAccess.SaveDatabase(db); GetListofTables getListofTables = new GetListofTables(_sqlConnection, db); getListofTables.Run(); repositoryAccess.SaveTables(dbId, getListofTables.ListofTables); } ))); Task.WaitAll(databaseTasks.ToArray()); }
static DataCollector() { repositoryAccess = new RepositoryAccess(); manager = new ConnectionManager(); }