I'm using Quartz.NET. https://www.quartz-scheduler.net/
Could I call other service from myTask? I will need my context because I need to update my database. And I don't know how catch the context.
All example that I've found about Quartz library, they are very simple like print in console
public class MyTask : IJob
{
private IRegion _region;
public Task Execute(IJobExecutionContext context)
{
switch (context.JobDetail.Key.ToString())
{
case "app.chargeMDM":
_region.CalculateData(0);
Console.WriteLine(string.Format("[{0}]: Hora de comer!", DateTime.Now));
break;
case "app.5min":
Console.WriteLine(string.Format("[{0}]: La app esta UP!.", DateTime.Now));
break;
}
return null;
}
}
For example it's my service
public class RegionService : IRegion
{
PanelANRContext _context;
public RegionService(PanelANRContext context)
{
_context = context;
}
...
}