Hi,
I need to run some code before and after the job is finished. (So for example, creating a database connection, and closing it when the job is complete).
I don’t want to do this in the job itself, because when the code runs in its normal application there already is a database connection.
I found the JobFilters (http://docs.hangfire.io/en/latest/extensibility/using-job-filters.html), and i would like to know if OnPerformed is called even when an error happened in the job, or is there a better way to always execute code before and after a job?
Unfortunately i can’t do the following thing:
BackgroundJob.Enqueue(()=> { using(var con = new Connection()) { ClassA.ExecuteJob() } )