System.Configuration.Configuration.FindLocationConfiguration C# (CSharp) Метод

FindLocationConfiguration() приватный Метод

private FindLocationConfiguration ( string relativePath, Configuration defaultConfiguration ) : Configuration
relativePath string
defaultConfiguration Configuration
Результат Configuration
		internal Configuration FindLocationConfiguration (string relativePath, Configuration defaultConfiguration)
		{
			Configuration parentConfig = defaultConfiguration;

			if (!String.IsNullOrEmpty (LocationConfigPath)) {
				Configuration parentFile = GetParentWithFile ();
				if (parentFile != null) {
					string parentRelativePath = system.Host.GetConfigPathFromLocationSubPath (configPath, relativePath);
					parentConfig = parentFile.FindLocationConfiguration (parentRelativePath, defaultConfiguration);
				}
			}

			string relConfigPath = configPath.Substring (1) + "/";
			if (relativePath.StartsWith (relConfigPath, StringComparison.Ordinal))
				relativePath = relativePath.Substring (relConfigPath.Length);

			ConfigurationLocation loc = Locations.FindBest (relativePath);
			if (loc == null)
				return parentConfig;
			
			loc.SetParentConfiguration (parentConfig);
			return loc.OpenConfiguration ();
		}
		

Usage Example

Пример #1
0
        internal Configuration FindLocationConfiguration(string relativePath, Configuration defaultConfiguration)
        {
            Configuration parentConfig = defaultConfiguration;

            if (!String.IsNullOrEmpty(LocationConfigPath))
            {
                Configuration parentFile = GetParentWithFile();
                if (parentFile != null)
                {
                    string parentRelativePath = system.Host.GetConfigPathFromLocationSubPath(configPath, relativePath);
                    parentConfig = parentFile.FindLocationConfiguration(parentRelativePath, defaultConfiguration);
                }
            }

            string relConfigPath = configPath.Substring(1) + "/";

            if (relativePath.StartsWith(relConfigPath, StringComparison.Ordinal))
            {
                relativePath = relativePath.Substring(relConfigPath.Length);
            }

            ConfigurationLocation loc = Locations.FindBest(relativePath);

            if (loc == null)
            {
                return(parentConfig);
            }

            loc.SetParentConfiguration(parentConfig);
            return(loc.OpenConfiguration());
        }
All Usage Examples Of System.Configuration.Configuration::FindLocationConfiguration