23 lines
455 B
C#
23 lines
455 B
C#
using BackgroundService.Services;
|
|
using Hangfire;
|
|
|
|
namespace BackgroundService.Jobs;
|
|
|
|
public class JobSchedulerRegistrator
|
|
{
|
|
|
|
private readonly ITestService _testService;
|
|
public JobSchedulerRegistrator(ITestService testService)
|
|
{
|
|
_testService = testService;
|
|
}
|
|
|
|
public void Register()
|
|
{
|
|
RecurringJob.AddOrUpdate(
|
|
"job1",
|
|
() => _testService.Execute(),
|
|
Cron.Hourly
|
|
);
|
|
}
|
|
} |