forked from anjoy8/Blog.Core
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathJobSetup.cs
More file actions
25 lines (22 loc) · 772 Bytes
/
JobSetup.cs
File metadata and controls
25 lines (22 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Blog.Core.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Quartz.Spi;
using System;
namespace Blog.Core.Extensions
{
/// <summary>
/// Cors 启动服务
/// </summary>
public static class JobSetup
{
public static void AddJobSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddHostedService<Job1TimedService>();
services.AddHostedService<Job2TimedService>();
services.AddSingleton<IJobFactory, JobFactory>();
services.AddTransient<Job_Blogs_Quartz>();//Job使用瞬时依赖注入
services.AddSingleton<ISchedulerCenter, SchedulerCenterServer>();
}
}
}