presence_new/console_ui/Program.cs

26 lines
953 B
C#
Raw Normal View History

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