private static DeploymentLocationsSection LoadSection() { DeploymentLocationsSection section = (DeploymentLocationsSection)ConfigurationManager.GetSection(DeploymentLocationsSection.SectionElementName); //if(section == null) // throw new ConfigurationErrorsException("deploymentLocations config section not found"); //if(section == null) // return new DeploymentLocationsSection(); return(section); }
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); } } }