* Removed stupid extensions
* Fixed WebHost NRE on adding
This commit is contained in:
@@ -27,20 +27,6 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
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>
|
||||
/// Replaces TelegramBotWebHostBuilder. Configures DI, options, and handlers.
|
||||
/// </summary>
|
||||
@@ -60,7 +46,7 @@ namespace Telegrator
|
||||
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);
|
||||
action?.Invoke(new TelegramBotWebHostBuilder(builder));
|
||||
action?.Invoke(new TelegramBotWebHostBuilder(builder, handlers));
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,20 +31,6 @@ public static class HostBuilderExtensions
|
||||
/// </summary>
|
||||
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>
|
||||
/// Replaces TelegramBotHostBuilder. Configures DI, options, and handlers.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user