mirror of https://github.com/AMT-Cheif/Stylet.git
Use multi-binding in bootstrapper
This commit is contained in:
parent
df7e024bf5
commit
764cfe0b39
|
@ -51,8 +51,7 @@ namespace Stylet
|
|||
|
||||
var viewManager = new ViewManager(this.GetInstance, new List<Assembly>() { this.GetType().Assembly });
|
||||
// Bind it to both IViewManager and to itself, so that people can get it with Container.Get<ViewManager>()
|
||||
builder.Bind<ViewManager>().ToInstance(viewManager).AsWeakBinding();
|
||||
builder.Bind<IViewManager>().ToInstance(viewManager).AsWeakBinding();
|
||||
builder.Bind<IViewManager>().And<ViewManager>().ToInstance(viewManager).AsWeakBinding();
|
||||
|
||||
builder.Bind<IWindowManagerConfig>().ToInstance(this).AsWeakBinding();
|
||||
builder.Bind<IWindowManager>().To<WindowManager>().InSingletonScope().AsWeakBinding();
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace StyletUnitTests
|
|||
Assert.IsInstanceOf<WindowManager>(ioc.Get<IWindowManager>());
|
||||
Assert.IsInstanceOf<IEventAggregator>(ioc.Get<IEventAggregator>());
|
||||
Assert.IsInstanceOf<ViewManager>(ioc.Get<IViewManager>());
|
||||
Assert.IsInstanceOf<ViewManager>(ioc.Get<ViewManager>());
|
||||
Assert.IsInstanceOf<MessageBoxViewModel>(ioc.Get<IMessageBoxViewModel>());
|
||||
|
||||
// Test autobinding
|
||||
Assert.DoesNotThrow(() => ioc.Get<RootViewModel>());
|
||||
|
|
Loading…
Reference in New Issue