-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathComposition.cs
36 lines (31 loc) · 1.13 KB
/
Composition.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
// ReSharper disable UnusedMember.Local
// ReSharper disable ArrangeTypeMemberModifiers
namespace BlazorWebAssemblyApp;
using Clock.Models;
using Clock.ViewModels;
using Pure.DI;
using Pure.DI.MS;
using WeatherForecast;
using static Pure.DI.Lifetime;
partial class Composition : ServiceProviderFactory<Composition>
{
void Setup() => DI.Setup()
// Use the DI setup from the base class
.DependsOn(Base)
// View Models
.Bind().As(Singleton).To<ClockViewModel>()
// Provides the composition root for Clock view model
.Root<IClockViewModel>(nameof(ClockViewModel))
// Services
.Bind().To<Log<TT>>()
.Bind().As(Singleton).To<Timer>()
.Bind().As(PerBlock).To<SystemClock>()
.Bind().As(Singleton).To<WeatherForecastService>()
// Provides the composition root for Weather Forecast service
.Root<IWeatherForecastService>()
.Bind().As(Singleton).To<CounterService>()
// Provides the composition root for Counter service
.Root<ICounterService>()
// Infrastructure
.Bind().To<Dispatcher>();
}