2025-07-24 23:19:59 +04:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2026-03-08 19:43:48 +04:00
|
|
|
using Microsoft.Extensions.Diagnostics.Metrics;
|
2025-07-24 23:19:59 +04:00
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
2026-03-06 23:19:24 +04:00
|
|
|
using Telegrator.Core;
|
2025-07-24 23:19:59 +04:00
|
|
|
|
|
|
|
|
#pragma warning disable IDE0001
|
2026-03-09 13:23:21 +04:00
|
|
|
namespace Telegrator.Hosting;
|
|
|
|
|
|
2026-04-03 19:23:53 +04:00
|
|
|
/// <inheritdoc/>
|
2026-03-15 17:20:53 +04:00
|
|
|
public class TelegramBotHostBuilder : ITelegramBotHostBuilder
|
2025-07-24 23:19:59 +04:00
|
|
|
{
|
2026-04-27 09:56:44 +04:00
|
|
|
private readonly IHostApplicationBuilder _innerBuilder;
|
2026-03-09 13:23:21 +04:00
|
|
|
internal IHandlersCollection _handlers = null!;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public IHandlersCollection Handlers => _handlers;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public IServiceCollection Services => _innerBuilder.Services;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public IConfigurationManager Configuration => _innerBuilder.Configuration;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public ILoggingBuilder Logging => _innerBuilder.Logging;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public IHostEnvironment Environment => _innerBuilder.Environment;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2026-04-27 09:56:44 +04:00
|
|
|
public IDictionary<object, object> Properties => _innerBuilder.Properties;
|
2026-03-09 13:23:21 +04:00
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public IMetricsBuilder Metrics => _innerBuilder.Metrics;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="TelegramBotHostBuilder"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="hostApplicationBuilder"></param>
|
2026-04-27 09:56:44 +04:00
|
|
|
public TelegramBotHostBuilder(IHostApplicationBuilder hostApplicationBuilder)
|
2026-03-09 13:23:21 +04:00
|
|
|
{
|
|
|
|
|
_innerBuilder = hostApplicationBuilder ?? throw new ArgumentNullException(nameof(hostApplicationBuilder));
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-26 00:01:46 +04:00
|
|
|
/// <summary>
|
2026-03-09 13:23:21 +04:00
|
|
|
/// Initializes a new instance of the <see cref="TelegramBotHostBuilder"/> class.
|
2025-07-26 00:01:46 +04:00
|
|
|
/// </summary>
|
2026-03-09 13:23:21 +04:00
|
|
|
/// <param name="hostApplicationBuilder"></param>
|
|
|
|
|
/// <param name="handlers"></param>
|
2026-04-27 09:56:44 +04:00
|
|
|
public TelegramBotHostBuilder(IHostApplicationBuilder hostApplicationBuilder, IHandlersCollection handlers)
|
2026-03-09 13:23:21 +04:00
|
|
|
{
|
|
|
|
|
_innerBuilder = hostApplicationBuilder ?? throw new ArgumentNullException(nameof(hostApplicationBuilder));
|
2026-04-03 19:23:53 +04:00
|
|
|
_handlers = handlers ?? throw new ArgumentNullException(nameof(handlers));
|
2026-03-09 13:23:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public void ConfigureContainer<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory, Action<TContainerBuilder>? configure = null) where TContainerBuilder : notnull
|
2025-07-24 23:19:59 +04:00
|
|
|
{
|
2026-03-15 17:20:53 +04:00
|
|
|
_innerBuilder.ConfigureContainer(factory, configure);
|
2025-07-24 23:19:59 +04:00
|
|
|
}
|
|
|
|
|
}
|