pr1/presence/console_ui/Program.cs

28 lines
1.0 KiB
C#
Raw Normal View History

2024-12-23 09:12:26 +00:00
using presence.data.Repository;
using presence.domain.UseCase;
using presence.ui;
2024-12-05 09:30:01 +00:00
using Microsoft.Extensions.DependencyInjection;
2024-12-23 09:12:26 +00:00
using System.Text.RegularExpressions;
using presence.data.RemoteData.RemoteDataBase;
2024-12-05 09:30:01 +00:00
2024-12-23 09:12:26 +00:00
IServiceCollection services = new ServiceCollection();
2024-12-05 09:30:01 +00:00
2024-12-23 09:12:26 +00:00
services
2024-12-05 09:30:01 +00:00
.AddDbContext<RemoteDatabaseContext>()
2024-12-19 17:36:57 +00:00
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
2024-12-23 09:12:26 +00:00
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
2024-12-19 17:36:57 +00:00
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<UserUseCase>()
.AddSingleton<GroupUseCase>()
.AddSingleton<PresenceUseCase>()
2024-12-23 09:12:26 +00:00
.AddSingleton<PresenceConsoleUI>()
2024-12-19 17:36:57 +00:00
.AddSingleton<MainMenuUI>();
2024-12-05 09:30:01 +00:00
2024-12-23 09:12:26 +00:00
// Создание провайдера сервисов
var serviceProvider = services.BuildServiceProvider();
2024-12-05 09:30:01 +00:00
2024-12-23 09:12:26 +00:00
// Получение экземпляра главного пользовательского интерфейса
MainMenuUI mainMenuUI = serviceProvider.GetService<MainMenuUI>();
2024-12-05 09:30:01 +00:00
2024-12-23 09:12:26 +00:00
// Вывод главного меню
mainMenuUI.DisplayMenu();