* Removed stupid extensions

* Fixed WebHost NRE on adding
This commit is contained in:
gutii
2026-04-23 22:37:10 +04:00
parent cb024e52ff
commit 468022ae0e
2 changed files with 1 additions and 29 deletions
+1 -15
View File
@@ -27,20 +27,6 @@ namespace Telegrator
/// </summary> /// </summary>
public const string HandlersCollectionPropertyKey = nameof(IHandlersCollection); public const string HandlersCollectionPropertyKey = nameof(IHandlersCollection);
extension(WebApplicationBuilder builder)
{
/// <summary>
/// Gets the <see cref="IHandlersCollection"/> from the builder properties.
/// </summary>
public IHandlersCollection Handlers
{
get
{
return (IHandlersCollection)builder.Host.Properties[HandlersCollectionPropertyKey];
}
}
}
/// <summary> /// <summary>
/// Replaces TelegramBotWebHostBuilder. Configures DI, options, and handlers. /// Replaces TelegramBotWebHostBuilder. Configures DI, options, and handlers.
/// </summary> /// </summary>
@@ -60,7 +46,7 @@ namespace Telegrator
public static IHostApplicationBuilder AddTelegratorWeb(this WebApplicationBuilder builder, TelegratorOptions? options = null, IHandlersCollection? handlers = null, Action<ITelegramBotHostBuilder>? action = null) public static IHostApplicationBuilder AddTelegratorWeb(this WebApplicationBuilder builder, TelegratorOptions? options = null, IHandlersCollection? handlers = null, Action<ITelegramBotHostBuilder>? action = null)
{ {
AddTelegratorWebInternal(builder.Services, builder.Configuration, ((IHostApplicationBuilder)builder).Properties, ref handlers, options); AddTelegratorWebInternal(builder.Services, builder.Configuration, ((IHostApplicationBuilder)builder).Properties, ref handlers, options);
action?.Invoke(new TelegramBotWebHostBuilder(builder)); action?.Invoke(new TelegramBotWebHostBuilder(builder, handlers));
return builder; return builder;
} }
-14
View File
@@ -31,20 +31,6 @@ public static class HostBuilderExtensions
/// </summary> /// </summary>
public const string HandlersCollectionPropertyKey = nameof(IHandlersCollection); public const string HandlersCollectionPropertyKey = nameof(IHandlersCollection);
extension (HostApplicationBuilder builder)
{
/// <summary>
/// Gets the <see cref="IHandlersCollection"/> from the builder properties.
/// </summary>
public IHandlersCollection Handlers
{
get
{
return (IHandlersCollection)((IHostApplicationBuilder)builder).Properties[HandlersCollectionPropertyKey];
}
}
}
/// <summary> /// <summary>
/// Replaces TelegramBotHostBuilder. Configures DI, options, and handlers. /// Replaces TelegramBotHostBuilder. Configures DI, options, and handlers.
/// </summary> /// </summary>