📄
MatDenDagen/Services/NotificationServiceExtensions.cs
using System; using Microsoft.Extensions.DependencyInjection; namespace MatDenDagen.Services; public static class NotificationServiceExtensions { public static IServiceCollection AddNotificationService(this IServiceCollection services) { services.AddOptions<NotificationServiceOptions>().BindConfiguration("NotificationService"); services.AddTransient<NotificationService>(); services.AddHostedService<NotificationBackgroundService>(); return services; } } public sealed class NotificationServiceOptions { public TimeSpan CheckInterval { get; set; } = TimeSpan.FromMinutes(5); }