NICWebApi.Extensions.Schedule 1.0.41

dotnet add package NICWebApi.Extensions.Schedule --version 1.0.41
                    
NuGet\Install-Package NICWebApi.Extensions.Schedule -Version 1.0.41
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NICWebApi.Extensions.Schedule" Version="1.0.41" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NICWebApi.Extensions.Schedule" Version="1.0.41" />
                    
Directory.Packages.props
<PackageReference Include="NICWebApi.Extensions.Schedule" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NICWebApi.Extensions.Schedule --version 1.0.41
                    
#r "nuget: NICWebApi.Extensions.Schedule, 1.0.41"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NICWebApi.Extensions.Schedule@1.0.41
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NICWebApi.Extensions.Schedule&version=1.0.41
                    
Install as a Cake Addin
#tool nuget:?package=NICWebApi.Extensions.Schedule&version=1.0.41
                    
Install as a Cake Tool

NICWebApi.Extensions.Schedule

NICWebApi.Extensions.Schedule 是独立的轻量级定时任务扩展库,默认使用 Cronos 调度引擎,提供 Cron、固定间隔、启动立即执行、并发控制、ASP.NET Core HostedService 执行能力和内置任务看板。

它不负责动态 API、统一返回格式、远程 HTTP 请求、JWT 认证、Swagger UI 或持久化任务。任务看板只展示和控制本模块任务,认证授权交给 ASP.NET Core 管道或自定义配置处理。

数据库执行记录默认关闭,需要显式开启并注册 IScheduleExecutionRecordStore。多实例分布式锁默认关闭,需要显式启用 Redis。

快速开始

builder.Services.AddSchedule();
builder.Services.AddCronJob<CleanupJob>("cleanup", "0 */5 * * * *");

默认看板入口:

app.UseScheduleUI();

浏览器打开 /schedule 即可查看任务、暂停/恢复任务或手动触发任务。

运行时快捷控制:

using NICWebApi.Extensions.Schedule.Extensions;

await "cleanup".TriggerScheduleAsync(scheduleManager);
"cleanup".PauseSchedule(scheduleManager);
"cleanup".ResumeSchedule(scheduleManager);
var snapshot = "cleanup".GetScheduleSnapshot(scheduleManager);

数据库执行记录按需开启:

builder.Services.AddSchedule(options =>
{
    options.ExecutionRecords.Enabled = true;
});

builder.Services.AddScoped<IScheduleExecutionRecordStore, EfCoreScheduleExecutionRecordStore>();

Redis 分布式锁按需开启:

builder.Services.AddSchedule(options => options.UseRedis("localhost:6379", "my-api:schedule:"));
using NICWebApi.Extensions.Schedule.Abstractions;
using NICWebApi.Extensions.Schedule.Models;

public sealed class CleanupJob : IScheduledJob
{
    public Task ExecuteAsync(ScheduleExecutionContext context, CancellationToken cancellationToken)
    {
        return Task.CompletedTask;
    }
}

固定间隔任务:

builder.Services.AddIntervalJob<ReportJob>("report", TimeSpan.FromMinutes(10), options =>
{
    options.RunOnStart = true;
    options.AllowConcurrentExecutions = false;
});

更多内容:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NICWebApi.Extensions.Schedule:

Package Downloads
NICWebApi.Extensions.AspNetCore

NICWebApi ASP.NET Core 一键集成扩展包,组合 DynamicAPI、RESTfulResult、JWT、Mapper、DependencyInjection、Http、RemoteRequest、Caching、Idempotency、Schedule、Messaging 和 OperationLogging 的默认注册。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.41 149 7/7/2026