* hotfix of aspects inspection

* Added IHandlersManager. interface that allows both collecting and providing handlers
This commit is contained in:
2025-08-19 12:10:40 +04:00
parent 6905045cde
commit 92df5e9c79
9 changed files with 168 additions and 16 deletions
+13 -9
View File
@@ -3,17 +3,14 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Text;
using Telegram.Bot.Types.Enums;
using Telegrator.Configuration;
using Telegrator.Hosting.Components;
using Telegrator.Hosting.Providers;
using Telegrator.Hosting.Web.Components;
using Telegrator.Hosting.Logging;
using Telegrator.Logging;
using Telegrator.MadiatorCore;
using Telegrator.MadiatorCore.Descriptors;
@@ -199,15 +196,22 @@ namespace Telegrator.Hosting.Web
Logger.LogInformation(logBuilder.ToString());
}
private void RegisterHostServices(IServiceCollection service, IHandlersCollection handlers)
private void RegisterHostServices(IServiceCollection services, IHandlersCollection handlers)
{
//service.RemoveAll<IHost>();
//service.AddSingleton<IHost>(this);
service.AddSingleton<ITelegramBotHost>(this);
service.AddSingleton<ITelegramBotWebHost>(this);
service.AddSingleton<ITelegratorBot>(this);
service.AddSingleton<IHandlersCollection>(handlers);
services.AddSingleton<ITelegramBotHost>(this);
services.AddSingleton<ITelegramBotWebHost>(this);
services.AddSingleton<ITelegratorBot>(this);
services.AddSingleton(handlers);
if (handlers is IHandlersManager manager)
{
services.RemoveAll<IHandlersProvider>();
services.AddSingleton<IHandlersProvider>(manager);
services.AddSingleton(manager);
}
}
}
}
@@ -15,7 +15,7 @@
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.15.4</Version>
<Version>1.15.5</Version>
</PropertyGroup>
<ItemGroup>