* Removed stupid extensions
* Fixed WebHost NRE on adding
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user