Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz compiling job scripts after runtime?

I want to use Quartz to act as a script scheduler, you write the VB from a GUI and then select a trigger, the code is then compiled and executed on the trigger, the difficult bit is how do I handle it so that it runs this script with in the application context so it can access my entity framework models, etc. How would I achieve this?

like image 629
Jacob Mason Avatar asked Jul 06 '16 07:07

Jacob Mason


1 Answers

Basically what you need is to put Quartz.Server on top of your application. Add this project to your solution.

If you just need to use your entities in quartz jobs then add your project with entities as reference to Quartz.Server and use entities as you do in your main app.

If you use some IoC-container then you can use extensions like this to inject dependecies to the job. Or you can write your own SchedulerFactory and JobFactory and build your job environment here.

like image 166
Alexey Merson Avatar answered Nov 04 '22 13:11

Alexey Merson