mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Options;
|
|
using Volo.Abp.Modularity;
|
|
using Volo.Abp.Quartz;
|
|
|
|
namespace Volo.Abp.BackgroundJobs.Quartz
|
|
{
|
|
[DependsOn(
|
|
typeof(AbpBackgroundJobsAbstractionsModule),
|
|
typeof(AbpQuartzModule)
|
|
)]
|
|
public class AbpBackgroundJobsQuartzModule : AbpModule
|
|
{
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
context.Services.AddTransient(typeof(QuartzJobExecutionAdapter<>));
|
|
}
|
|
|
|
public override void OnPreApplicationInitialization(ApplicationInitializationContext context)
|
|
{
|
|
var options = context.ServiceProvider.GetService<IOptions<AbpBackgroundJobOptions>>().Value;
|
|
if (!options.IsJobExecutionEnabled)
|
|
{
|
|
var quartzOptions = context.ServiceProvider.GetService<IOptions<AbpQuartzOptions>>().Value;
|
|
quartzOptions.StartSchedulerFactory = scheduler => Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|
|
}
|