/// <summary>
        /// 获取配置文件根路径。
        /// </summary>
        /// <returns>配置文件根路径。</returns>
        public string GetConfigFileRootPath <T>() where T : class
        {
            bool supportMultiLanguages = false;
            Type configType            = typeof(T);
            ConfigFileAttribute configFileAttribute = AttributeHelper.GetConfigAttribute <ConfigFileAttribute>(configType);

            if (configFileAttribute != null)
            {
                supportMultiLanguages = configFileAttribute.SupportMultiLanguages;
            }

            string path             = "";
            string fileMappingPath  = "";
            string groupMappingPath = "";

            // 获取所有文件映射
            FileMappingCollection fileMappings = GetFileMappings();
            FileMapping           fileMapping  = null;

            if (fileMappings.Contains(configType.Name))
            {
                fileMapping = fileMappings.Get(configType.Name);
            }
            else if (fileMappings.Contains(configType.FullName))
            {
                fileMapping = fileMappings.Get(configType.FullName);
            }

            if (fileMapping != null)
            {
                fileMappingPath  = fileMapping.Path;
                groupMappingPath = fileMapping.FileGroupMapping.Path;
            }

            if (fileMappingPath != "")
            {
                path = GetConfigPath(fileMappingPath);
            }
            else if (groupMappingPath != "")
            {
                path = GetConfigPath(groupMappingPath);
            }
            else
            {
                path = supportMultiLanguages ? MultiLanguageRootPath : RootPath;
            }

            return(supportMultiLanguages ?
                   string.Format("{0}/{1}", path, ApplicationContext.LanguageCode) : path);
        }
        /// <summary>
        /// 获取所有配置文件映射。
        /// </summary>
        /// <value>所有配置文件映射。</value>
        /// <exception cref="ConfigurationErrorsException">配置文件映射关系名重复。</exception>
        /// <remarks>
        /// 一个配置文件只能从属于一个文件组。
        /// </remarks>
        public FileMappingCollection GetFileMappings()
        {
            FileMappingCollection fileMappings = new FileMappingCollection();

            if (FileGroupMappings != null)
            {
                foreach (FileGroupMapping group in FileGroupMappings)
                {
                    foreach (FileMapping file in group.FileMappings)
                    {
                        if (fileMappings.Contains(file.Name))
                        {
                            ConfigThrowHelper.ThrowConfigException(R.ConfigError_DuplicateFileMapping, file.Name);
                        }

                        file.FileGroupMapping = group;
                        fileMappings.Add(file);
                    }
                }
            }
            return(fileMappings);
        }