I'm trying to understand the following code used in Nop Commerece task. It has classes which are implemented as below. The project is in the Plugins
folder. One class implements ITask
interface.
Public class foo:ITask
{
public void Execute()
{
......
}
}
Another implements BasePlugin, Iplugin
public class SmartWarehousePlugin : BasePlugin, IPlugin
{
public override void Install()
{
...
}
public override void Uninstall()
{
....
}
....
}
I understand the concept of Task and Plugin in NOP. I went through different tutorials. But I didn't find one where ITask
and BasePlugin,IPlugin
are used together. Why and when we need to do this?
As per my knowledge,
ITask
is an interface, using that you can create your own task in task scheduler andBasePlugin
interface having install, uninstall methods , so using that methods, you can add custom things at installation/uninstallation.Now the question are When? and Why? So, when you want to create/start your task just after plugin installation (or for similar kind of functionality) at that time you can use both together. Why part depends on your requirements.