/* * This file is a strongly-typed representation of the solution's configuration files. This class is basically the server-side equivalent of the Code/Configuration.js file in the SampleWebsite. By using this a class like this you have a way to make sure that you aren't misspelling the configuration entry you are looking for. It also gives you a list of configuration options in Intellisense. Furthermore, by using a class like this, you can add special rules and contraints to your solution's configuration in a very centralized manner. Perhaps you want to always throw an exception when a required configuration element is missing or if an element is missing you don't want to throw an exception, but would rather have a default returned. So, using a strongly-typed representation of your configuration files is always a good idea. */ using System; using System.Configuration; using General; using System.Diagnostics; namespace Sample { public static class SampleConfiguration { public static String SiteName { get { return ConfigurationFacade.ApplicationSettings("SiteName"); } } public static String GenericErrorMessage { get { String value = ConfigurationFacade.ApplicationSettings("GenericErrorMessage"); if (String.IsNullOrEmpty(value)) { throw new ConfigurationErrorsException("GenericErrorMessage is required."); } return value; } } public static TraceSwitch GlobalTraceSwitch { get { return new TraceSwitch("TracingSwitch", "Global Tracing Switch"); } } } }