简体   繁体   English

错误消息“未为此对象定义无参数构造函数”

[英]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.

相关问题 错误:未为此对象定义无参数构造函数 - Error: No parameterless constructor defined for this object 奇怪的错误:没有为此对象定义无参数构造函数 - Strange error: No parameterless constructor defined for this object 在MVC中没有为此对象错误定义无参数构造函数 - No parameterless constructor defined for this object error in MVC ModelBinding 抛出错误 No parameterless constructor defined for this object - ModelBinding throws error No parameterless constructor defined for this object 没有为此对象定义无参数构造函数 - No parameterless constructor defined for this object 自动映射器错误 - “没有为此对象定义无参数构造函数” - Auto Mapper Error - "No Parameterless constructor defined for this object" automapper 中没有为此 object 定义无参数构造函数 - No parameterless constructor defined for this object in automapper 在mvc中没有为此对象定义无参数构造函数 - No parameterless constructor defined for this object in mvc MissingMethodException:没有为此对象定义无参数构造函数 - MissingMethodException: no parameterless constructor defined for this object 下拉菜单允许我遇到问题-没有为此对象定义无参数构造函数 - dropdown allows problems to I get error - No parameterless constructor defined for this object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM