mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-12-29 09:05:47 +08:00
feat: ✨ 计划作业 (#87)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using Furion.Schedule;
|
||||
using NetAdmin.SysComponent.Host.Jobs;
|
||||
|
||||
namespace NetAdmin.SysComponent.Host.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// ServiceCollection 扩展方法
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加定时任务
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSchedules(this IServiceCollection me)
|
||||
{
|
||||
return me.AddSchedule( //
|
||||
builder => builder //
|
||||
.AddJob<ScheduledJob>(false, Triggers.PeriodSeconds(5).SetRunOnStart(true)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user