-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (30 loc) · 1.31 KB
/
Program.cs
File metadata and controls
37 lines (30 loc) · 1.31 KB
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
using Microsoft.Extensions.DependencyInjection;
using RideSharing.Application.Interfaces;
using RideSharing.Application.Services;
using RideSharing.Infrastructure.Persistence;
using RideSharing.Infrastructure.UnitOfWork;
using RideSharing.Presentation.ConsoleUI;
// ---------------------------------------------------------------
// Composition Root — wire up the dependency injection container.
// All services and repositories are registered as singletons so
// that the shared in-memory lists inside JsonUnitOfWork remain
// consistent throughout the application lifetime.
// ---------------------------------------------------------------
var services = new ServiceCollection();
// Infrastructure
services.AddSingleton<JsonFileService>();
services.AddSingleton<IUnitOfWork, JsonUnitOfWork>();
// Application Services
services.AddSingleton<PaymentService>();
services.AddSingleton<AuthService>();
services.AddSingleton<RideService>();
services.AddSingleton<RatingService>();
services.AddSingleton<ReportService>();
// Presentation
services.AddSingleton<PassengerMenu>();
services.AddSingleton<DriverMenu>();
services.AddSingleton<AdminMenu>();
services.AddSingleton<MainMenu>();
var provider = services.BuildServiceProvider();
// Resolve the top-level menu and start the application.
provider.GetRequiredService<MainMenu>().Start();