presence/Demo/Program.cs

31 lines
1.4 KiB
C#
Raw Normal View History

2024-10-25 08:47:11 +00:00
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.Repository;
2024-10-21 12:41:56 +00:00
using Demo.Domain.UseCase;
using Demo.UI;
2024-10-25 08:47:11 +00:00
using Microsoft.Extensions.DependencyInjection;
2024-10-21 12:41:56 +00:00
2024-10-23 09:44:48 +00:00
// Создаем экземпляр репозиториев
2024-10-21 12:41:56 +00:00
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
2024-10-25 08:47:11 +00:00
PresenceRepositoryImpl presenceRepositoryImpl = new PresenceRepositoryImpl();
IServiceCollection services = new ServiceCollection();
services.AddDbContext<RemoteDatabaseContext>().
AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>();
services.AddDbContext<RemoteDatabaseContext>().
AddSingleton<IUserRepository, SQLUserRepositoryImpl>();
services.AddDbContext<RemoteDatabaseContext>().
AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>();
2024-10-21 12:41:56 +00:00
2024-10-23 09:44:48 +00:00
// Создаем UseCase для пользователей и групп
2024-10-21 12:41:56 +00:00
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
GroupUseCase groupUseCase = new GroupUseCase(groupRepositoryImpl);
2024-10-23 09:44:48 +00:00
UseCaseGeneratePresence presenceUseCase = new UseCaseGeneratePresence(userRepositoryImpl, presenceRepositoryImpl);
2024-10-21 12:41:56 +00:00
2024-10-23 09:44:48 +00:00
// Создаем пользовательский интерфейс
MainMenuUI mainMenuUI = new MainMenuUI(userUseCase, groupUseCase, presenceUseCase);
2024-10-21 12:41:56 +00:00
2024-10-23 09:44:48 +00:00
// Выводим главное меню
2024-10-21 12:41:56 +00:00
mainMenuUI.DisplayMenu();