Skip to content

AutoConfiguration

Furkan Güngör edited this page Feb 6, 2022 · 3 revisions

Usage

Would you like to automatically register the cron jobs you created?

If your answer is yes, you can do this by following the steps below.

  • Install EasyCronJob.AutoConfigurer from Nuget
  • In the appsettings env file, define it as follows.
"CronJobs": {
    "ConsoleCronJob": {
      "CronExpression": "*/10 * * * * *",
      "TimeZoneInfo": "Local",
      "CronFormat": "IncludeSeconds"
    },
    "MyJob": {
      "CronExpression": "*/2 * * * *",
      "TimeZoneInfo": "Local",
      "CronFormat": "Standard"
    }
  }
  • Add the following codes to Startup.cs.
public void ConfigureServices(IServiceCollection services)
{
    services.InitializeCronServices();
    services.AutoConfigurer();
}
  • Sit back and sip your coffee.

Clone this wiki locally