* Added missing summaries

This commit is contained in:
2026-03-07 00:17:31 +04:00
parent 1ebf4ec22a
commit 3cdc058fb5
18 changed files with 1045 additions and 964 deletions
@@ -49,11 +49,12 @@ namespace Telegrator.Hosting.Web
/// Initializes a new instance of the <see cref="WebApplicationBuilder"/> class.
/// </summary>
/// <param name="webApplicationBuilder">The proxied instance of host builder.</param>
/// <param name="handlers"></param>
public TelegramBotWebHost(WebApplicationBuilder webApplicationBuilder, IHandlersCollection handlers)
public TelegramBotWebHost(WebApplicationBuilder webApplicationBuilder)
{
// Registering this host in services for easy access
RegisterHostServices(webApplicationBuilder.Services, handlers);
webApplicationBuilder.Services.AddSingleton<ITelegramBotHost>(this);
webApplicationBuilder.Services.AddSingleton<ITelegramBotWebHost>(this);
webApplicationBuilder.Services.AddSingleton<ITelegratorBot>(this);
// Building proxy application
_innerApp = webApplicationBuilder.Build();
@@ -161,15 +162,5 @@ namespace Telegrator.Hosting.Web
GC.SuppressFinalize(this);
_disposed = true;
}
private void RegisterHostServices(IServiceCollection services, IHandlersCollection handlers)
{
//service.RemoveAll<IHost>();
//service.AddSingleton<IHost>(this);
services.AddSingleton<ITelegramBotHost>(this);
services.AddSingleton<ITelegramBotWebHost>(this);
services.AddSingleton<ITelegratorBot>(this);
}
}
}
@@ -46,6 +46,8 @@ namespace Telegrator.Hosting.Web
_innerBuilder = webApplicationBuilder ?? throw new ArgumentNullException(nameof(webApplicationBuilder));
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
_handlers = new HostHandlersCollection(Services, _settings);
_innerBuilder.AddTelegratorWeb(settings);
}
/// <summary>
@@ -60,7 +62,7 @@ namespace Telegrator.Hosting.Web
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
_handlers = handlers ?? throw new ArgumentNullException(nameof(settings));
_innerBuilder.AddTelegratorWeb(settings);
_innerBuilder.AddTelegratorWeb(settings, handlers);
}
/// <summary>
@@ -69,38 +71,7 @@ namespace Telegrator.Hosting.Web
/// <returns></returns>
public TelegramBotWebHost Build()
{
if (_handlers is IHostHandlersCollection hostHandlers)
{
foreach (PreBuildingRoutine preBuildRoutine in hostHandlers.PreBuilderRoutines)
{
try
{
preBuildRoutine.Invoke(this);
}
catch (NotImplementedException)
{
_ = 0xBAD + 0xC0DE;
}
}
}
if (!_settings.DisableAutoConfigure)
{
Services.Configure<TelegratorWebOptions>(Configuration.GetSection(nameof(TelegratorWebOptions)));
Services.Configure<TelegramBotClientOptions>(Configuration.GetSection(nameof(TelegramBotClientOptions)), new TelegramBotClientOptionsProxy());
}
else
{
if (null == Services.SingleOrDefault(srvc => srvc.ImplementationType == typeof(IOptions<TelegratorWebOptions>)))
throw new MissingMemberException("Auto configuration disabled, yet no options of type 'TelegratorWebOptions' wasn't registered. This configuration is runtime required!");
if (null == Services.SingleOrDefault(srvc => srvc.ImplementationType == typeof(IOptions<TelegramBotClientOptions>)))
throw new MissingMemberException("Auto configuration disabled, yet no options of type 'TelegramBotClientOptions' wasn't registered. This configuration is runtime required!");
}
Services.AddSingleton<IConfigurationManager>(Configuration);
Services.AddSingleton<IOptions<TelegratorOptions>>(Options.Create(_settings));
return new TelegramBotWebHost(_innerBuilder, _handlers);
return new TelegramBotWebHost(_innerBuilder);
}
}
}