Cron-based task scheduler using Cronos for .NET applications. Enables background job scheduling with flexible cron expressions, configurable execution intervals, and integration with hosted services for automated recurring tasks.
License
—
Deps
7
Install Size
—
Vulns
✓ 0
Published
Dec 10, 2025
$ dotnet add package SolTechnology.Core.SchedulerThe SolTechnology.Core.Scheduler library provides minimum functionality needed for scheduled background tasks. It handles needed services registration and configuration. It is based on Hangfire.Cronos library. The service is using in-memory scheduler, so does not share the scheduling information between instances.
For installing the library, reference SolTechnology.Core.Scheduler nuget package and invoke AddScheduledJob<T>() service collection extension method:
services.AddScheduledJob<SynchornizeCristianoRonaldoMatches>();
"Configuration": {
"ScheduledJobs": [
{
"JobName": "SynchornizeCristianoRonaldoMatches",
"CronExpression": "0 0 * * *"
}
]
}
In this case, JobName has to match registered service (T) name.
builder.Services.AddScheduledJob<SynchornizeCristianoRonaldoMatches>(new ScheduledJobConfiguration("0 0 * * *")); //every day at midnight
public class SynchornizeCristianoRonaldoMatches : ScheduledJob
public SynchornizeCristianoRonaldoMatches(
ISchedulerConfigurationProvider schedulerConfigurationProvider,
IServiceScopeFactory serviceScopeFactory,
ILogger<ScheduledJob> logger)
: base(schedulerConfigurationProvider, serviceScopeFactory, logger)
{
var scope = serviceScopeFactory.CreateScope();
var handler = scope.ServiceProvider.GetRequiredService<ICommandHandler<SynchronizePlayerMatchesCommand>>();
_handler = handler;
}
public override async Task Execute()
{
await _handler.Handle(new SynchronizePlayerMatchesCommand(44));
}