diff --git a/Core/Extensions/StartupExtension.cs b/Core/Extensions/StartupExtension.cs index 1cd4c46..fa40220 100644 --- a/Core/Extensions/StartupExtension.cs +++ b/Core/Extensions/StartupExtension.cs @@ -1,15 +1,20 @@ using System.Collections.Concurrent; using Kruzya.TelegramBot.Core.Cache; +using Kruzya.TelegramBot.Core.Options; using Microsoft.Extensions.DependencyInjection; -namespace Kruzya.TelegramBot.Core.Extensions -{ - public static class StartupExtension - { - public static IServiceCollection AddQueue(this IServiceCollection collection) - => collection.AddSingleton>(); +namespace Kruzya.TelegramBot.Core.Extensions; + +public static class StartupExtension +{ + public static IServiceCollection AddQueue(this IServiceCollection collection) + => collection.AddSingleton>(); + + public static IServiceCollection AddMemoryCache(this IServiceCollection collection) + => collection.AddSingleton>(); + + public static IServiceCollection AddOption(this IServiceCollection collection) where T : class, IOption + => collection.AddScoped() + .AddScoped(s => s.GetService()); - public static IServiceCollection AddMemoryCache(this IServiceCollection collection) - => collection.AddSingleton>(); - } } \ No newline at end of file