- mapper文件为json格式
- 合并原则:后面覆盖前面
- env 为操作系统 linux window
var env = EnvPFUtil.CurrentEnv();
var os = EnvPFUtil.CurrentSystemName();
IConfigurationBuilder configBuilder =
new ConfigurationBuilder().
SetBasePath(PhyPathUtil.ConvertVirToPhyPath(path));
var lstFile = new List<string>();
lstFile.Add($"{appPath}/basis/{confPath}{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}.{env}{suffix}");
//配置分开,便于维护 start
lstFile.Add($"{appPath}/basis/{confPath}__dimdata{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}__dimdata.{env}{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}__columns{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}__columns.{env}{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}__responsefield{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}
__responsefield.{env}{suffix}");
//统计
lstFile.Add($"{appPath}/basis/{confPath}__statistics{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}
__statistics.{env}{suffix}");
//配置分开,便于维护 end
lstFile.Add($"{appPath}/basis/{confPath}
_res_{resField}{suffix}");
lstFile.Add($"{appPath}/basis/{confPath}
_res_{resField}.{env}{suffix}");
//后台,用于区分表,避免文件太多照成混乱
lstFile.Add($"{appPath}/{ownerId}/backstage/{confPath}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/backstage
/{confPath}.{env}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}.{env}{suffix}");
//配置分开,便于维护 start
lstFile.Add($"{appPath}/{ownerId}/{confPath}__dimdata{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
__dimdata.{env}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}__columns{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
__columns.{env}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
__responsefield{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
__responsefield.{env}{suffix}");
//统计
lstFile.Add($"{appPath}/{ownerId}/{confPath}
__statistics{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
__statistics.{env}{suffix}");
//配置分开,便于维护 end
lstFile.Add($"{appPath}/{ownerId}/{confPath}.{sysId}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}.{sysId}.{env}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}_res_{resField}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
_res_{resField}.{env}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
_res_{resField}.{sysId}{suffix}");
lstFile.Add($"{appPath}/{ownerId}/{confPath}
_res_{resField}.{sysId}.{env}{suffix}");
//操作系统特殊配置
lstFile.Add($"{appPath}/{ownerId}/{confPath}.{env}.{os}{suffix}");
foreach (var item in lstFile)
{
if (!FileUtil.ExistsFilesByVirPath($"{path}/{item}")) continue;
configBuilder.AddJsonFile($"{item}", optional: true,
reloadOnChange: true);
}
文档更新时间: 2021-08-07 12:09 作者:admin