Apq.Cfg 是一个统一配置管理系统,支持多种配置格式(JSON、INI、XML、YAML、TOML、Env)和远程配置中心(Redis、Database、Consul、Etcd、Nacos、Apollo、Zookeeper、Vault)。
appsettings 作为配置文件名示例config.json、config.local.json、settings.json 等作为示例文件名app/config/ 或 /app/config/{Format}CfgSource(如 JsonCfgSource、ConsulCfgSource){Format}CfgOptions(如 ConsulCfgOptions、EtcdCfgOptions)Add{Format}(如 AddJson、AddConsul)所有项目支持 net6.0;net7.0;net8.0;net9.0 四个目标框架。
创建扩展项目(如 Apq.Cfg.Xxx)时,必须在扩展项目目录下创建 README.md 文档,包含:
主项目 Apq.Cfg/README.md 需要包含所有扩展项目的使用示例代码。
解决方案根目录下的 README.md 是主文档,需要包含:
增加新的公开功能后,必须:
tests/Apq.Cfg.Tests.Shared/ 中添加对应的测试类benchmarks/Apq.Cfg.Benchmarks/ 中添加对应的基准测试tests/README.md,添加新测试类的说明benchmarks/README.md,添加新基准测试的说明Apq.Cfg/ # 核心库(JSON、环境变量、DI 集成)
Apq.Cfg.Ini/ # INI 格式支持
Apq.Cfg.Xml/ # XML 格式支持
Apq.Cfg.Yaml/ # YAML 格式支持
Apq.Cfg.Toml/ # TOML 格式支持
Apq.Cfg.Env/ # .env 文件格式支持
Apq.Cfg.Redis/ # Redis 配置源
Apq.Cfg.Database/ # 数据库配置源
Apq.Cfg.Consul/ # Consul 配置中心
Apq.Cfg.Etcd/ # Etcd 配置中心
Apq.Cfg.Nacos/ # Nacos 配置中心
Apq.Cfg.Apollo/ # Apollo 配置中心
Apq.Cfg.Zookeeper/ # Zookeeper 配置中心
Apq.Cfg.Vault/ # HashiCorp Vault 密钥管理
Apq.Cfg.SourceGenerator/ # 源生成器(Native AOT)
tests/ # 单元测试
benchmarks/ # 性能基准测试
Samples/ # 示例项目
# 构建
dotnet build
# 运行测试
dotnet test
# 运行性能测试
dotnet run -c Release --project benchmarks/Apq.Cfg.Benchmarks -f net9.0