/// <summary> /// Gets a single app setting based on the current location. /// </summary> /// <param name="key"></param> /// <returns></returns> public static string GetAppSetting(string key) { //return CurrentAppSettingValues[key]; DeploymentLocationSettings location = CurrentLocation; return(DeploymentUtil.GetSetting(location == null ? null : location.AppSettings, ConfigurationManager.AppSettings, key)); }
/// <summary> /// Gets a single connection string based on the current location. /// </summary> /// <param name="connectionName"></param> /// <returns></returns> public static string GetConnection(string connectionName) { //return CurrentConnectionStringValues[connectionName]; DeploymentLocationSettings location = CurrentLocation; return(DeploymentUtil.GetConnectionString(location == null ? null : location.ConnectionStrings, ConfigurationManager.ConnectionStrings, connectionName)); }
internal static DeploymentLocationSettings GetLocationByHostNameChecked(DeploymentLocationsSection section, string hostName) { DeploymentLocationSettings location = section.GetLocationByHostName(hostName); if (location == null) { throw new ConfigurationErrorsException(String.Format("Current deploymentLocation cannot be determined for host name: \"{0}\"", hostName)); } return(location); }
internal DeploymentLocationsManagerInternal() { _CurrentHostName = DeploymentLocationsManager.GetCurrentHostNameChecked(); DeploymentLocationsSection section = DeploymentLocationsManager.DeploymentLocationsSection; _AppSettings = new NameValueCollection(ConfigurationManager.AppSettings); _ConnectionStrings = DeploymentUtil.GetValueCollection(ConfigurationManager.ConnectionStrings); if (section == null) { //_CurrentLocation = new DeploymentLocationSettings(); } else { _CurrentLocation = DeploymentLocationsManager.GetLocationByHostNameChecked(section, _CurrentHostName); if (_CurrentLocation != null) { _AppSettings = DeploymentUtil.CreateMergedCopy(DeploymentUtil.GetValueCollection(_CurrentLocation.AppSettings), _AppSettings); _ConnectionStrings = DeploymentUtil.CreateMergedCopy(DeploymentUtil.GetValueCollection(_CurrentLocation.ConnectionStrings), _ConnectionStrings); } } }