[OneBot] changed dependency injection logic of MessageService.cs and OperationService.cs
This commit is contained in:
parent
5c0e352bc5
commit
b6e7567fe4
|
@ -35,9 +35,9 @@ public class LagrangeApp : IHost
|
|||
{
|
||||
_hostApp = host;
|
||||
Logger = Services.GetRequiredService<ILogger<LagrangeApp>>();
|
||||
|
||||
MessageService = new MessageService(Instance, WebService);
|
||||
OperationService = new OperationService(Instance, WebService);
|
||||
|
||||
MessageService = Services.GetRequiredService<MessageService>();
|
||||
OperationService = Services.GetRequiredService<OperationService>();
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken = new())
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System.Text.Json;
|
||||
using Lagrange.Core.Common;
|
||||
using Lagrange.Core.Common.Interface;
|
||||
using Lagrange.OneBot.Core;
|
||||
using Lagrange.OneBot.Core.Message;
|
||||
using Lagrange.OneBot.Core.Network;
|
||||
using Lagrange.OneBot.Core.Operation;
|
||||
|
@ -75,7 +74,11 @@ public sealed class LagrangeAppBuilder
|
|||
|
||||
public LagrangeAppBuilder ConfigureOneBot()
|
||||
{
|
||||
Services.AddSingleton<ContextBase, LiteDbContext>();
|
||||
Services.AddSingleton<ILagrangeWebService, ReverseWSService>();
|
||||
|
||||
Services.AddSingleton<MessageService>();
|
||||
Services.AddSingleton<OperationService>();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue