2026-07-27 14:26:04 +08:00
|
|
|
|
using MiGu.DB.Kernel.Hosting;
|
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2026-06-22 09:15:42 +08:00
|
|
|
|
|
|
|
|
|
|
namespace MiGu.Server.Persistence;
|
|
|
|
|
|
|
2026-07-27 14:26:04 +08:00
|
|
|
|
/// <summary>兼容入口:转调 MiGu.DB Hosting,并注册本进程业务服务。</summary>
|
2026-06-22 09:15:42 +08:00
|
|
|
|
public static class PlatformPersistence
|
|
|
|
|
|
{
|
|
|
|
|
|
public static IServiceCollection AddPlatformPersistence(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
|
{
|
2026-07-27 14:26:04 +08:00
|
|
|
|
services.AddMiGuDb(configuration);
|
2026-06-22 09:15:42 +08:00
|
|
|
|
|
2026-07-27 14:26:04 +08:00
|
|
|
|
services.AddScoped<Wms.WmsReferenceValidator>();
|
|
|
|
|
|
services.AddScoped<Wms.WmsService>();
|
|
|
|
|
|
services.AddScoped<Wms.WmsTransportRuleService>();
|
|
|
|
|
|
services.AddScoped<Wms.WmsTransportPlanner>();
|
|
|
|
|
|
services.AddScoped<Wms.WmsTransportTaskService>();
|
|
|
|
|
|
services.AddScoped<Wms.IWmsDispatchAdapter, Wms.NoopWmsDispatchAdapter>();
|
|
|
|
|
|
services.AddScoped<SimpleFields.SimpleFieldService>();
|
|
|
|
|
|
services.AddScoped<Dashboard.DashboardShortcutService>();
|
2026-06-22 09:15:42 +08:00
|
|
|
|
return services;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-27 14:26:04 +08:00
|
|
|
|
/// <summary>启动建库/迁移入口(内部即 MigrateMiGuDbAsync:Migrate + 基线 + DataMigrator)。</summary>
|
|
|
|
|
|
public static Task EnsurePlatformDatabaseAsync(this IServiceProvider services)
|
|
|
|
|
|
=> services.MigrateMiGuDbAsync();
|
2026-06-22 09:15:42 +08:00
|
|
|
|
}
|