You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
using System;
|
|
using EntrustSettle.Common;
|
|
using EntrustSettle.Extensions.HostedService;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace EntrustSettle.Extensions;
|
|
|
|
public static class InitializationHostServiceSetup
|
|
{
|
|
/// <summary>
|
|
/// 应用初始化服务注入
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
public static void AddInitializationHostServiceSetup(this IServiceCollection services)
|
|
{
|
|
if (services is null)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(nameof(services));
|
|
}
|
|
|
|
if (AppSettings.app("AppSettings", "SeedDBEnabled").ObjToBool())
|
|
{
|
|
services.AddHostedService<SeedDataHostedService>();
|
|
}
|
|
if (AppSettings.app("QuartzNetJob", "Enabled").ObjToBool())
|
|
{
|
|
services.AddHostedService<QuartzJobHostedService>();
|
|
}
|
|
if (AppSettings.app(new string[] { "EventBus", "Enabled" }).ObjToBool())
|
|
{
|
|
services.AddHostedService<EventBusHostedService>();
|
|
}
|
|
}
|
|
} |