Skip to main content

ZeroAlloc.Scheduling Documentation

Source-generated background job scheduler for .NET 8 and .NET 10.

Reference

#GuideDescription
1Getting StartedInstall and schedule your first job in five minutes
2Source Generator[Job], Every, Cron, generated extension methods
3BackendsInMemory, EF Core, and Redis store configuration
4DashboardEmbedded HTML dashboard and Blazor component
5Mediator BridgeRoute job execution through ZeroAlloc.Mediator
6DiagnosticsZASCH001 compiler warning reference
7PerformanceThroughput, allocation profile, and tuning guide

Quick Reference

// Fire-and-forget job
[Job]
public sealed class SendWelcomeEmailJob : IJob
{
public async ValueTask ExecuteAsync(JobContext ctx, CancellationToken ct) { ... }
}
services.AddScheduling().AddSchedulingInMemory().AddSendWelcomeEmailJob();
await scheduler.EnqueueAsync(new SendWelcomeEmailJob { To = "[email protected]" }, ct);

// Recurring job (every hour)
[Job(Every = Every.Hour)]
public sealed class PurgeExpiredTokensJob : IJob
{
public async ValueTask ExecuteAsync(JobContext ctx, CancellationToken ct) { ... }
}
// AddPurgeExpiredTokensJob() also registers an IHostedService that seeds the schedule on startup

// Recurring job (custom cron)
[Job(Cron = "0 9 * * 1-5")] // weekdays at 09:00
public sealed class DailyReportJob : IJob { ... }

// Dashboard
app.MapJobsDashboard("/jobs");