Example #1
0
        /// <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();
        }