Demo/Program.cs
2024-10-30 09:35:19 +03:00

26 lines
953 B
C#

using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.Repository;
using Demo.Domain.UseCase;
using Demo.UI;
using Microsoft.Extensions.DependencyInjection;
IServiceCollection services = new ServiceCollection();
services
.AddDbContext<RemoteDatabaseContext>()
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<IAdminRepository, SQLAdminRepositoryImpl>()
.AddSingleton<IGroupUseCase, GroupUseCase>()
.AddSingleton<IUserUseCase, UserUseCase>()
.AddSingleton<IPresenceUseCase, PresenceUseCase>()
.AddSingleton<IAdminUseCase, AdminUseCase>()
.AddSingleton<UserConsoleUI>()
.AddSingleton<AdminConsoleUI>()
.AddSingleton<MainMenuUI>();
var serviceProvider = services.BuildServiceProvider();
MainMenuUI? mainMenuUI = serviceProvider.GetService<MainMenuUI>();