/* This file is the server-side counter part of Code/Configuration.js in the SampleWebsite. It's base purpose is to provide a strongly-typed way of accessing configuration in the web.config or app.config files. This way no one ever has to use the built in 'ConfigurationManager' and risk spelling a particular configuration incorrectly. */ 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; } } }