/// <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));
        }
Beispiel #3
0
 internal bool MatchesHostName(string hostName)
 {
     //foreach(DeploymentLocationHost host in this.Hosts)
     //{
     //    if(host.MatchesHostName(hostName))
     //        return true;
     //}
     //return false;
     foreach (string name in this.HostNames)
     {
         if (DeploymentUtil.HostNameEquals(hostName, name))
         {
             return(true);
         }
     }
     return(false);
 }
        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);
                }
            }
        }
 internal bool MatchesHostName(string hostName)
 {
     return(DeploymentUtil.HostNameEquals(hostName, this.Name));
 }