I am using the Galasoft MVVM Toolkit and ServiceLocator to manage my services in my application. I would like to manage two different implementation of service. A stub implementation should be injected in a debug/design mode and a real implementation should be injected in other cases. A pseudo code could be :
public TmepServiceLocator(){
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
//If DEBUG/DESIGN MODE
//SimpleIoc.Default.Register<IMyService>(() => new MyServiceStub());
//ELSE
SimpleIoc.Default.Register<IMyService>(() => new MyServiceImpl());
}
public IMyService MyService{
get{return ServiceLocator.Current.GetInstance<IMyService>();}
}
How can I do that ?
Do you have a workaround to work with service stubs when developping (and without using Spring)?