|
public class JobHost : IRegisteredObject { public JobHost() { HostingEnvironment.RegisterObject(this); } public void Stop(bool immediate) { HostingEnvironment.UnregisterObject(this); } public void DoWork(Action work) { work(); } } ... new JobHost().DoWork(() => { /* ... get the job done... */ }); ...
Install-Package Quartz public class MyJob : IJob { public void Execute(IJobExecutionContext context) { // ... just get the job done here } }