-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
24 lines (22 loc) · 882 Bytes
/
App.xaml.cs
File metadata and controls
24 lines (22 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Common;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using Ninject;
using Ninject.Modules;
using System.Windows;
namespace NinjectDI {
public partial class App : Application {
protected override void OnStartup(StartupEventArgs e) {
IKernel kernel = new StandardKernel(new MyModule());
IocServiceProvider.Default.ConfigureServices(kernel);
base.OnStartup(e);
}
}
public class MyModule : NinjectModule {
public override void Load() {
Bind(typeof(IDataStorage<Person>)).To(typeof(PersonStorage)).InSingletonScope();
Bind(typeof(IDetailViewModel), typeof(DetailViewModel)).To(ViewModelSource.GetPOCOType(typeof(DetailViewModel))).InSingletonScope();
Bind(typeof(CollectionViewModel)).To(ViewModelSource.GetPOCOType(typeof(CollectionViewModel)));
}
}
}