/// <summary> /// Creates a configuration section handler. /// </summary> /// <param name="parent"></param> /// <param name="configContext">Configuration context object.</param> /// <param name="section"></param> /// <returns>The created section handler object.</returns> public object Create(object parent, object configContext, XmlNode section) { ExpergentOptions options = new ExpergentOptions(); if (section.Attributes["ruleFolder"] != null) options.RuleFolder = section.Attributes["ruleFolder"].Value; if (section.Attributes["loadRulesFromAssemblies"] != null) options.LoadRulesFromAssemblies = bool.Parse(section.Attributes["loadRulesFromAssemblies"].Value); return options; }
/// <summary> /// Creates a configuration section handler. /// </summary> /// <param name="parent"></param> /// <param name="configContext">Configuration context object.</param> /// <param name="section"></param> /// <returns>The created section handler object.</returns> public object Create(object parent, object configContext, XmlNode section) { ExpergentOptions options = new ExpergentOptions(); if (section.Attributes["ruleFolder"] != null) { options.RuleFolder = section.Attributes["ruleFolder"].Value; } if (section.Attributes["loadRulesFromAssemblies"] != null) { options.LoadRulesFromAssemblies = bool.Parse(section.Attributes["loadRulesFromAssemblies"].Value); } return(options); }
/// <summary> /// Initializes the config. /// </summary> /// <param name="sectionName">Name of the section.</param> private static void InitializeConfig(string sectionName) { options = ConfigurationManager.GetSection(sectionName) as ExpergentOptions; }
/// <summary> /// Initializes the config. /// </summary> private static void InitializeConfig() { InitializeConfig("Expergent"); if (options == null) { InitializeConfig("expergent"); } if (options == null) { options = new ExpergentOptions(); } }