[英]Error message “No parameterless constructor defined for this object”
var plugins = Activator.CreateInstance(types.First()) as IPluginFinder;
This code stops with error in nopcommerce 4.10, These are that, In the previous version had no problem (4.00) 此代码在nopcommerce 4.10中由于错误而停止,这些是,在以前的版本中没有问题(4.00)
Full code: 完整代码:
var types = typeFinder.FindClassesOfType<IPluginFinder>();
if (types.Count() == 1)
{
var plugins = Activator.CreateInstance(types.First()) as IPluginFinder;
var currentPlugin = plugins.GetPluginDescriptorBySystemName("misc.myplugin");
if (currentPlugin == null || currentPlugin.Installed == false)
return;
}
Error: No parameterless constructor defined for this object
错误:未为此对象定义无参数构造函数
With version 4.10 the PluginFinder
class got a new constructor which needs a parameter of type IEventPublisher
(see github commit ). 在版本4.10中,
PluginFinder
类获得了一个新的构造函数,该构造函数需要一个IEventPublisher
类型的参数(请参阅github commit )。 You will need to provide a value for that parameter. 您将需要为该参数提供一个值。 I don't know this product, but maybe you'll find something about that in the release notes or the docs.
我不知道该产品,但也许您会在发行说明或文档中找到有关此产品的信息。
IEventPublisher evtPub = ...; //
var plugins = Activator.CreateInstance(types.First(), evtPub) as IPluginFinder;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.