/* * This work is licensed under the Creative Commons Attribution 2.5 License. * To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ * or send a letter to Creative Commons, 543 Howard Street, 5th Floor, * San Francisco, California, 94105, USA. * * Original developer: David Betz * */ using System; using System.Configuration; namespace General { public static class ConfigurationFacade { public static String ApplicationSettings(String key) { String value = System.Configuration.ConfigurationManager.AppSettings[key]; if (String.IsNullOrEmpty(value)) { throw new ConfigurationErrorsException(String.Format("{0} is required in the application configuration file", key)); } return value; } public static String ConnectionString(String key) { String value = System.Configuration.ConfigurationManager.ConnectionStrings[key].ConnectionString; if (String.IsNullOrEmpty(value)) { throw new ConfigurationErrorsException(String.Format("{0} is required in the application configuration file", key)); } return value; } } }