// // Return a config implemented by IConfigurationHandler, // and use the runtime cache to store it for quick retreival without // having to hit a config record and a demand for ConfigurationPermission. // private object GetHandlerSection(string sectionName, Type type, ResultsIndex index) { // check the results cache object result = _results[(int)index]; if (result != s_unevaluatedResult) { return(result); } // Get the configuration object. // // Note that it is legal for an IConfigurationSectionHandler implementation // to return null. result = GetSectionObject(sectionName); // verify the object is of the expected type if (result != null && result.GetType() != type) { throw new ConfigurationErrorsException(SR.GetString(SR.Config_unable_to_get_section, sectionName)); } // store into results cache if (index != ResultsIndex.UNUSED) { _results[(int)index] = result; } return(result); }
private object GetHandlerSection(string sectionName, Type type, ResultsIndex index) { object sectionObject = this._results[(int) index]; if (sectionObject == s_unevaluatedResult) { sectionObject = this.GetSectionObject(sectionName); if ((sectionObject != null) && (sectionObject.GetType() != type)) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_unable_to_get_section", new object[] { sectionName })); } if (index != ResultsIndex.UNUSED) { this._results[(int) index] = sectionObject; } } return sectionObject; }
// // Return a configuration section, and use the runtime cache to store it for // quick retreival without having to hit a config record and a demand for // ConfigurationPermission. // private object GetSection(string sectionName, Type type, ResultsIndex index) { // check the results cache object result = _results[(int)index]; if (result != s_unevaluatedResult) { return(result); } // get the configuration object result = GetSectionObject(sectionName); if (result == null) { // A section implemented by ConfigurationSection may not return null, // but various error handling subclasses of RuntimeConfig may need it. // Throw an error if null is not permitted. if (!_permitNull) { throw new ConfigurationErrorsException(SR.GetString(SR.Config_unable_to_get_section, sectionName)); } } else { // verify the object is of the expected type if (result.GetType() != type) { throw new ConfigurationErrorsException(SR.GetString(SR.Config_unable_to_get_section, sectionName)); } } // store into results cache if (index != ResultsIndex.UNUSED) { _results[(int)index] = result; } return(result); }
// // Return a configuration section, and use the runtime cache to store it for // quick retreival without having to hit a config record and a demand for // ConfigurationPermission. // private object GetSection(string sectionName, Type type, ResultsIndex index) { // check the results cache object result = _results[(int)index]; if (result != s_unevaluatedResult) { return result; } // get the configuration object result = GetSectionObject(sectionName); if (result == null) { // A section implemented by ConfigurationSection may not return null, // but various error handling subclasses of RuntimeConfig may need it. // Throw an error if null is not permitted. if (!_permitNull) { throw new ConfigurationErrorsException(SR.GetString(SR.Config_unable_to_get_section, sectionName)); } } else { // verify the object is of the expected type if (result.GetType() != type) { throw new ConfigurationErrorsException(SR.GetString(SR.Config_unable_to_get_section, sectionName)); } } // store into results cache if (index != ResultsIndex.UNUSED) { _results[(int)index] = result; } return result; }
// // Return a config implemented by IConfigurationHandler, // and use the runtime cache to store it for quick retreival without // having to hit a config record and a demand for ConfigurationPermission. // private object GetHandlerSection(string sectionName, Type type, ResultsIndex index) { // check the results cache object result = _results[(int)index]; if (result != s_unevaluatedResult) { return result; } // Get the configuration object. // // Note that it is legal for an IConfigurationSectionHandler implementation // to return null. result = GetSectionObject(sectionName); // verify the object is of the expected type if (result != null && result.GetType() != type) { throw new ConfigurationErrorsException(SR.GetString(SR.Config_unable_to_get_section, sectionName)); } // store into results cache if (index != ResultsIndex.UNUSED) { _results[(int)index] = result; } return result; }
private object GetSection(string sectionName, Type type, ResultsIndex index) { object sectionObject = this._results[(int) index]; if (sectionObject == s_unevaluatedResult) { sectionObject = this.GetSectionObject(sectionName); if (sectionObject == null) { if (!this._permitNull) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_unable_to_get_section", new object[] { sectionName })); } } else if (sectionObject.GetType() != type) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_unable_to_get_section", new object[] { sectionName })); } if (index != ResultsIndex.UNUSED) { this._results[(int) index] = sectionObject; } } return sectionObject; }