public override async System.Threading.Tasks.Task ExecuteAsync(EmailSendingArgs args) { var job = await _backgroundJobRepository.FindAsync(args.Id).ConfigureAwait(false); if (job.HasProperty(nameof(JobProgress))) { job.SetProperty(nameof(JobProgress), new JobProgress()); } var progress = job.GetProperty <JobProgress>(nameof(JobProgress)); for (var i = 0; i < 10; i++) { using (var scope = AuditingManager.BeginScope()) { progress.Percentage = (i + 1) * 10; System.Threading.Thread.Sleep(1000); job.SetProperty(nameof(JobProgress), progress); await _backgroundJobRepository.UpdateAsync(job, true); await scope.SaveAsync(); } } }
public Task <BackgroundJobRecord> UpdateAsync(BackgroundJobRecord entity) { return(BackgroundJobRepository.UpdateAsync(entity)); }