using System;
using EntrustSettle.Common;
using EntrustSettle.Extensions.HostedService;
using Microsoft.Extensions.DependencyInjection;
namespace EntrustSettle.Extensions;
public static class InitializationHostServiceSetup
{
///
/// 应用初始化服务注入
///
///
public static void AddInitializationHostServiceSetup(this IServiceCollection services)
{
if (services is null)
{
ArgumentNullException.ThrowIfNull(nameof(services));
}
if (AppSettings.app("AppSettings", "SeedDBEnabled").ObjToBool())
{
services.AddHostedService();
}
if (AppSettings.app("QuartzNetJob", "Enabled").ObjToBool())
{
services.AddHostedService();
}
if (AppSettings.app(new string[] { "EventBus", "Enabled" }).ObjToBool())
{
services.AddHostedService();
}
}
}