-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathComposition.cs
33 lines (27 loc) · 990 Bytes
/
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
// ReSharper disable UnusedMember.Local
// ReSharper disable UnusedMember.Global
// ReSharper disable RedundantNameQualifier
namespace MAUIApp;
using Pure.DI;
using Pure.DI.MS;
using static Pure.DI.Lifetime;
using Timer = Clock.Models.Timer;
partial class Composition: ServiceProviderFactory<Composition>
{
// IMPORTANT:
// Only composition roots (regular or anonymous) can be resolved through the `IServiceProvider` interface.
// These roots must be registered using `Root(...)` or `RootBind()` calls.
private static void Setup() => DI.Setup()
.DependsOn(Base)
// Roots
.Root<AppShell>(nameof(AppShell))
.Root<IClockViewModel>(nameof(ClockViewModel))
// View Models
.Bind().As(Singleton).To<ClockViewModel>()
// Models
.Bind().To<Log<TT>>()
.Bind().As(Singleton).To<Timer>()
.Bind().As(PerBlock).To<SystemClock>()
// Infrastructure
.Bind().To<Dispatcher>();
}