-
Notifications
You must be signed in to change notification settings - Fork 11
/
IocApplicationModule.cs
41 lines (34 loc) · 2.14 KB
/
IocApplicationModule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Autofac;
using Core;
using SampleApplication.AppServices;
using SampleApplication.Commands;
using SampleApplication.Models;
using SampleApplication.ViewModels;
using SampleApplication.Views;
namespace SampleApplication
{
public class IocApplicationModule : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.RegisterType<Repository>().As<IRepository>().AsSelf().SingleInstance();
builder.RegisterType<LandingPageNavigationService>().As<ILandingPageNavigationService>().AsSelf().SingleInstance();
builder.RegisterType<AppCache>().As<IAppCache>().AsSelf().SingleInstance();
builder.RegisterType<UpdateProviderLocationsCommand>().As<IUpdateProviderLocationsCommand>().AsSelf();
//TODO: get rid of 2 kinds of bindings for validator
builder.RegisterType<AppointmentValidator>().As<IModelValidator<Appointment>>().AsSelf();
builder.RegisterType<AppointmentValidator>().Named<IModelValidator>(nameof(Appointment)); //for generic entry
builder.RegisterType<MainViewModel>().Named<IViewModel>(Constants.Navigation.MainPage);
builder.RegisterType<AppointmentViewModel>().Named<IViewModel>(Constants.Navigation.AppointmentPage);
builder.RegisterType<AuthViewModel>().Named<IViewModel>(Constants.Navigation.AuthPage);
builder.RegisterType<ProviderListViewModel>().Named<IViewModel>(Constants.Navigation.ProviderListPage);
builder.RegisterType<AppointmentScheduleViewModel>().Named<IViewModel>(Constants.Navigation.AppointmentSchedulePage);
builder.RegisterType<MainPage>().Named<IView>(Constants.Navigation.MainPage);
builder.RegisterType<AuthPage>().Named<IView>(Constants.Navigation.AuthPage);
builder.RegisterType<ProviderListPage>().Named<IView>(Constants.Navigation.ProviderListPage);
builder.RegisterType<AppointmentPage>().Named<IView>(Constants.Navigation.AppointmentPage);
builder.RegisterType<AppointmentSchedulePage>().Named<IView>(Constants.Navigation.AppointmentSchedulePage);
}
}
}