presence_new/console_ui/Program.cs
2024-11-16 15:02:17 +03:00

26 lines
953 B
C#

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();