小编end*_*der的帖子

Caliburn Micro构造函数注入失败

我学习卡利微并尝试使用的EventAggregator官方网站.

但是,我有一个例外

"没有为此对象定义无参数构造函数."

消息本身很清楚,但示例中也没有包含无参数构造函数.如果我添加一个,带有参数的构造函数不会被命中,IEventAggregator仍然没有正确注入.

添加无参数构造函数后,这是我的发布者VM(没有它,将抛出异常):

    public MainViewModel() { }

    public MainViewModel(IEventAggregator ea) : this()
    {
        eventAggregator = ea;
    }
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的引导程序:

public class AppBootstrapper : Bootstrapper<MainViewModel>
{
    private readonly SimpleContainer container = new SimpleContainer();

    protected override void Configure()
    {
        container.Singleton<IEventAggregator, EventAggregator>();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是CM的例子:

// Creating the EventAggregator as a singleton.
public class Bootstrapper : BootstrapperBase {
    private readonly SimpleContainer _container =
        new SimpleContainer();

     // ... Other Bootstrapper Config

    protected override void Configure(){
        _container.Singleton<IEventAggregator, EventAggregator>(); …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection eventaggregator caliburn.micro

11
推荐指数
2
解决办法
5507
查看次数

在GGTS 3.4中设置Grails在Proxy之后

我希望在运行从SpringSource下载的GGTS 3.4的setup.exe之后,分享我如何解决代理问题以在我公司的PC中设置GGTS的知识(通过google搜索整整一天的www;))

问题:

当我在IDE安装后开始构建我的hello world项目时,GGTS会提示我此错误消息:"错误无法解析依赖项".怎么解决?

proxy grails

1
推荐指数
1
解决办法
6385
查看次数