Home The Framework
The Framework

 

The problem

 

Programatically schedule and run some code.

 

The solution

 

One possible approach would be the following one:

  • a Schedule class to "remember" when the job should run;
  • a Job class that implements a Run() method. This method will contain the code that should run based on the schedule;
  • and a JobRunner class that, using a timer, will call the Run() method of the jobs at the appropriate moments, based on the schedules associated to the job.

 

Additionally you may want to configure the schedules from the configuration file, so you need a ConfigurationSection class and some ConfigurationElement classes to parse the configuration file.

 

All of these classes I already made them and in the next paragraphs I will try to explain how they are working and how you can use them.

 

 
Wheel of Time, Powered by Joomla!; Joomla templates by SG web hosting