new_presence/console_ui/Program.cs
2024-11-19 17:24:26 +03:00

28 lines
1023 B
C#

using data.RemoteData;
using data.Repository;
using domain.UseCase;
using ui;
using Microsoft.Extensions.DependencyInjection;
IServiceCollection services = new ServiceCollection();
services.AddDbContext<RemoteDatabaseContext>();
// Добавление репозиториев
services.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>();
services.AddSingleton<IUserRepository, SQLUserRepositoryImpl>();
services.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>();
// Добавление бизнес-логики (UseCase)
services.AddSingleton<UserUseCase>();
services.AddSingleton<GroupUseCase>();
services.AddSingleton<UseCaseGeneratePresence>();
// Добавление пользовательских интерфейсов
services.AddSingleton<GroupConsole>();
services.AddSingleton<PresenceConsole>();
services.AddSingleton<MainMenuUI>();
var serviceProvider = services.BuildServiceProvider();
MainMenuUI mainMenuUI = serviceProvider.GetService<MainMenuUI>();
mainMenuUI.DisplayMenu();