コード例 #1
0
        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);
        }
コード例 #2
0
 public MyScope(IServiceProvider sp, JobActivatorContext context)
     : this(sp, int.Parse(context.BackgroundJob.Id), context.GetJobParameter <string>("RecurringJobId"))
 {
 }