コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
                }
            }
        }