如何根据是否安装插件管理 NopCommerce 3.90 中的依赖项注册?

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

我创建了一个插件,因为我正在覆盖 ProductService(以及更多)中的一些方法。为此,我已将 CustomProductServie 注册到 IProductService

虽然我的插件已安装,但在卸载插件后它工作正常。它覆盖了 ProductService 方法。 (NopCommerce 3.90)

您可以使用插件描述名称检查如下,

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

如果pluginDescriptor为空,则插件未安装。另请注意,您需要在 class 中添加对 IPluginFinder 接口的引用。