mirror of
https://github.com/Jetsparrow/antiantiswearingbot.git
synced 2026-01-20 23:16:08 +03:00
12 lines
419 B
C#
12 lines
419 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace Jetsparrow.Aasb;
|
|
public static class IServiceCollectionExtensions
|
|
{
|
|
public static IServiceCollection AddHostedSingleton<TService>(this IServiceCollection isc) where TService : class, IHostedService
|
|
{
|
|
return isc.AddSingleton<TService>().AddHostedService(svc => svc.GetRequiredService<TService>());
|
|
}
|
|
}
|