Skip to content

Instantly share code, notes, and snippets.

@oschwab
Last active June 19, 2017 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oschwab/7a92c987da6e2d02b54ba004c5764319 to your computer and use it in GitHub Desktop.
Save oschwab/7a92c987da6e2d02b54ba004c5764319 to your computer and use it in GitHub Desktop.
Caliburn Micro : injection in ViewModel problem
public class AppBootstrapper : BootstrapperBase {
...
protected override void Configure() {
container = new SimpleContainer();
container.Instance(container);
container.Singleton<IWindowManager, WindowManager>();
container.Singleton<IEventAggregator, EventAggregator>();
container.PerRequest<ShellViewModel>();
container.PerRequest<IRepository<Worklist>, DBRepository<Worklist>>()
...
}
}
public class WorklistViewModel : Screen {
...
public WorklistViewModel(IRepository<Worklist> worklistRepository)
{
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment