public override JobActivatorScope BeginScope(JobActivatorContext context) { var retorno = base.BeginScope(context); var param = context.GetJobParameter <object>("HangfireContext"); var contextProvider = retorno.Resolve(typeof(IHangfireContextProvider)) as IHangfireContextProvider; contextProvider.SetContext(param); return(retorno); }
public MyScope(IServiceProvider sp, JobActivatorContext context) : this(sp, int.Parse(context.BackgroundJob.Id), context.GetJobParameter <string>("RecurringJobId")) { }