public async Task <CronAggregate?> FindByIdAsync(CronId id) { var cron = await _context.Crons .Include(c => c.Status) .FirstOrDefaultAsync(cr => cr.Id == id.Value); return(cron is null ? null : ToAggregate(cron)); }
public virtual async Task BeforeProcess(IJobExecutionContext context) { using var scope = GetScope(); var mediator = scope.ServiceProvider.GetRequiredService <IMediator>(); var id = await mediator.Send(new CronRegisteredRequest(context.JobDetail.Key.Name)); CronId = new CronId(id); }
public async Task RemoveAsync(CronId id) { var cron = await _context.Crons .FirstOrDefaultAsync(c => c.Id == id.Value); if (cron is not null) { _context.Remove(cron); } await _context.SaveChangesAsync(); }