注入 SQLHelper,插件可以直接使用

This commit is contained in:
milimoe 2026-01-03 21:30:41 +08:00
parent 449cb1df9b
commit 9dff7f7d56
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0

View File

@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.Logging.Console;
using Microsoft.IdentityModel.Tokens;
using Milimoe.FunGame;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Network;
@ -180,6 +181,13 @@ try
throw new NoUserLogonException();
});
builder.Services.AddTransient(provider =>
{
SQLHelper? sql = Factory.OpenFactory.GetSQLHelper();
if (sql != null) return sql;
throw new SQLServiceException();
});
builder.Services.AddTransient<JsonTool>();
WebApplication app = builder.Build();