Inserting into Database Schedule Task (Not plugin)

11 meses atrás
Hi everyone, in the documentation is described how to create and insert a new Schedule Task. In the plugin case it is all clear.
https://docs.nopcommerce.com/en/developer/tutorials/scheduled-tasks.html

1. You create a class that implements the IScheduleTask interface and then
2. Using the IScheduleTaskService in the InstallAsync method of your plugin, you add a record into the data base with the task.

But where to call the IScheduleTaskService in the main app, not in a plugin. In other words where is the Install method (similarly to plugins) in the nopcommerce app.
11 meses atrás
There is an installation service which adds the existing tasks
See src\Libraries\Nop.Services\Installation\InstallationService.cs
Otherwise you could do it with a migration for example see
src\Libraries\Nop.Data\Migrations\UpgradeTo460\DataMigration.cs
11 meses atrás
Yeah, that works. Thank you so much.