We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi @icsharp !
As long as there is no ExecuteAsync method support (hope yet) I tried to create a base class for my jobs.
public abstract class BaseRecurringJob : IRecurringJob { public void Execute(PerformContext context) { ExecuteAsync(context).GetAwaiter().GetResult(); } protected virtual Task ExecuteAsync(PerformContext context) => Task.CompletedTask; }
After that all my jobs can be used like so: public class HealthCheckRecurringJob: BaseRecurringJob
There is a problem that a Hangfire JobActivator tries to create my base abstract class instead of using child class.
As I can see there is something wrong with this line: option.JobType.GetMethod(nameof(IRecurringJob.Execute));
var addOrUpdate = Expression.Call( typeof(RecurringJob), nameof(RecurringJob.AddOrUpdate), new Type[] { method.DeclaringType }, new Expression[] { Expression.Constant(recurringJobId), Expression.Lambda(methodCall, x), Expression.Constant(cron), Expression.Constant(timeZone), Expression.Constant(queue) });
Could you please try to fix this issue?
Br, Alex
The text was updated successfully, but these errors were encountered:
In two words I would like to do something like that: https://www.codeproject.com/Tips/399786/Quartz-Net-Custom-Base-Job
Sorry, something went wrong.
No branches or pull requests
Hi @icsharp !
As long as there is no ExecuteAsync method support (hope yet) I tried to create a base class for my jobs.
After that all my jobs can be used like so:
public class HealthCheckRecurringJob: BaseRecurringJob
There is a problem that a Hangfire JobActivator tries to create my base abstract class instead of using child class.
As I can see there is something wrong with this line:
option.JobType.GetMethod(nameof(IRecurringJob.Execute));
Could you please try to fix this issue?
Br, Alex
The text was updated successfully, but these errors were encountered: