在通過an excellent intro讀到Caliburn.Micro後,有一件事我似乎錯過了,那就是how to register a class with a constructor which is expecting arguments?如何註冊IMobileServiceClient使用Caliburn.Micro.PhoneBootstrapper
有問題的行這裏是:
_container.PerRequest<IMobileServiceClient, MobileServiceClient>();
public class Bootstrapper : PhoneBootstrapper
{
private PhoneContainer _container;
protected override void Configure()
{
_container = new PhoneContainer();
_container.RegisterPhoneServices(RootFrame);
_container.PerRequest<MainPageViewModel>();
_container.PerRequest<IRepository, Repository>();
_container.PerRequest<IMobileServiceClient, MobileServiceClient>();
AddCustomConventions();
}
//...
}