1 refactor(config): 将AppSettings移至Application层并更新配置结构

2
    3 - 将AppSettings从DMS.Infrastructure移至DMS.Application
    4 - 将DatabaseSettings重命名为AppSettings.Database并更新所有引用
    5 - 将配置文件从appSettings.json更改为dms_config.json
    6 - 更新所有项目引用以使用新的AppSettings命名空间
    7 - 移除DI容器中的SqlSugarDbContext直接实例化
    8 - 添加Material Design Icons字体并更新设置视图UI
    9 - 通过移除不必要的变量映射更新来优化S7服务
   10 - 将数据库连接字符串属性名从Database更新为DbName
This commit is contained in:
2025-10-04 18:42:12 +08:00
parent abcaf3e160
commit ec1f94a898
14 changed files with 152 additions and 222 deletions

View File

@@ -2,6 +2,7 @@
using AutoMapper;
using AutoMapper.Internal;
using DMS.Application.Configurations;
using DMS.Application.Interfaces;
using DMS.Application.Interfaces.Database;
using DMS.Application.Services;
@@ -11,7 +12,6 @@ using DMS.Core.Interfaces.Repositories;
using DMS.Infrastructure.Data;
using DMS.Infrastructure.Repositories;
using Microsoft.Extensions.DependencyInjection;
using DMS.Infrastructure.Configurations;
namespace DMS.Infrastructure.UnitTests.Services;
@@ -37,11 +37,7 @@ public class BaseServiceTest
});
// 2. 配置数据库上下文 (在测试中通常使用单例)
services.AddSingleton<SqlSugarDbContext>(_ =>
{
var appSettings = new AppSettings { Database = { Database = "dms_test" } };
return new SqlSugarDbContext(appSettings);
});
services.AddSingleton<SqlSugarDbContext>();
// --- 注册服务和仓储 ---
// 使用 Transient 或 Scoped 取决于服务的生命周期需求对于测试Transient 通常更安全。