【发布时间】:2014-09-05 08:05:16
【问题描述】:
使用 Caliburn.Micro 2.0.1,我编辑了 AppBootStrapper.cs 以注入我的服务并且它正在工作,但我想知道是否有一种方法可以像你一样在设计时自动注入我的服务的模拟版本可以用 MVVM Light 吗?
例如
protected override void Configure()
{
_container = new SimpleContainer();
_container.PerRequest<MainViewModel>();
_container.Instance<IWindowManager>(new WindowManager());
_container.Singleton<IEventAggregator, EventAggregator>();
// like this...
if (IsInDesignMode)
{
_container.Instance<IMyService>(new MyServiceMock());
}
else
{
_container.Instance<IMyService>(new MyService());
}
}
【问题讨论】:
标签: c# mvvm caliburn.micro