public LogSetting Create(LogSetting parent, object configContext, XmlNode section) { if (parent != null) { throw new ConfigurationException("parent configuration sections are not allowed"); } int count = section.SelectNodes(LOGFACTORYADAPTER_ELEMENT).Count; if (count > 1) { throw new ConfigurationException("Only one <factoryAdapter> element allowed"); } if (count == 1) { return ReadConfiguration(section); } return null; }
/// <summary> /// Verifies that the logFactoryAdapter element appears once in the configuration section. /// </summary> /// <param name="parent">settings of a parent section - atm this must always be null</param> /// <param name="configContext">Additional information about the configuration process.</param> /// <param name="section">The configuration section to apply an XPath query too.</param> /// <returns> /// A <see cref="LogSetting" /> object containing the specified logFactoryAdapter type /// along with user supplied configuration properties. /// </returns> public LogSetting Create(LogSetting parent, object configContext, XmlNode section) { if (parent != null) { throw new ConfigurationException("parent configuration sections are not allowed"); } int logFactoryElementsCount = section.SelectNodes(LOGFACTORYADAPTER_ELEMENT).Count; if (logFactoryElementsCount > 0) { return ReadConfiguration(section); } else { return null; } }