z8018
2026-02-11 b8fb68b44c29e4667f6ea5746119413809a60a9e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Hosting;
using KH.WMS.Core.Setup;
 
// 此命名空间是为了向后兼容
namespace KH.WMS.Core.Setup;
 
/// <summary>
/// 服务集合配置 - 统一入口
/// </summary>
public static class ServiceCollectionSetup
{
    /// <summary>
    /// 添加所有基础设施服务
    /// </summary>
    public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration, IWebHostEnvironment environment)
    {
        // 数据库
        services.AddSqlSugarSetup(configuration);
 
        // 日志
        services.AddLoggingSetup(configuration);
 
        // 性能监控
        services.AddMonitoringSetup(configuration, environment);
 
        // API 文档
        services.AddApiDocumentationSetup(configuration);
 
        // HTTP 客户端
        services.AddHttpClient();
 
        return services;
    }
 
}