nopcommercenopcommerce-3.90

How to manage dependency registration in NopCommerce 3.90 depending upon plugin installed or not?


I have created one plugin, in that I am overriding some methods from ProductService (and more). For that I have registered my CustomProductServie to IProductService.

While my Plugin is installed, it is working fine but after uninstalling the plugin. it is overriding ProductService methods. (NopCommerce 3.90)


Solution

  • You can check using plugin description name as follows,

    var pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName("PluginSystemName");
    

    If pluginDescriptoris null, plugin is not installed. Also note, you need to add reference of IPluginFinder interface in your class.