/// <summary> /// Creates a new DatabaseLint object and sets up the configuration according to the specified configuration file /// </summary> public DatabaseLint(String configurationFile) : this() { this.ConfigFile = new XMLConfigFile(configurationFile); this.Config.Connection = ConfigFile.GetConnection(); //Get SQL rules from config file and add to allExecutables var SQLRules = ConfigFile.GetSQLRules(); this.AllExecutables.AddExecutables(SQLRules); //Select rules from executables this.Config.AllRules = this.AllExecutables.GetRules().Select(e => (IRule)e); //Load property values from config rule foreach (var r in Config.AllRules) { ConfigFile.ConfigureRule(r); } //Filter out rules which should not be run this.Config.RulesToRun = this.Config.AllRules.Where(r => ConfigFile.RunRule(r)); //Tables to run this.Config.TablesToCheck = ConfigFile.GetTablesToCheck(); }
//Constructor, create run from config file public Run(IConfigFile config) { this.ConfigFile = config; //Load all executables this.Executables = RuleLoader.LoadRules(); if (this.ConfigFile.IsValid()) { //Configure executables this.configureRulesFromConfig(); //Extract connection from config this.Connection = config.GetConnection(); //Set RulesToRun from the config file and configure this.setRulesToRunFromConfig(); } }