public class DuwamishConfiguration : IConfigurationSectionHandler { private static string dbConnectionString ; private static bool enablePageCache ; IConfigurationSectionHandler 成员#region IConfigurationSectionHandler 成员 public object Create(object parent, object configContext, System.Xml.XmlNode section) { NameValueCollection settings ; try { NameValueSectionHandler baseHandler = new NameValueSectionHandler() ; settings = (NameValueCollection)baseHandler.Create(parent,configContext,section) ; } catch { settings = null ; } if (settings != null) { dbConnectionString = (string)settings["dbConnectionString"] ; enablePageCache = Convert.ToBoolean(settings["enablePageCache"]) ; } return settings ; } #endregion public static string ConnectionString { get { return dbConnectionString ; } } public static bool EnablePageCache { get { return enablePageCache ; } } } |