pr1/Demo/Program.cs

31 lines
1011 B
C#
Raw Permalink Normal View History

2024-11-17 16:24:01 +00:00
using Demo.Data.RemoteData.RemoteDataBase;
2024-10-19 21:12:06 +00:00
using Demo.Data.Repository;
using Demo.Domain.UseCase;
using Demo.UI;
2024-11-17 16:24:01 +00:00
using Microsoft.Extensions.DependencyInjection;
2024-10-19 21:12:06 +00:00
2024-11-17 16:24:01 +00:00
// Создаем экземпляр репозиториев
2024-10-19 21:12:06 +00:00
2024-11-17 16:24:01 +00:00
IServiceCollection services = new ServiceCollection();
services
.AddDbContext<RemoteDatabaseContext>()
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<UserUseCase>()
.AddSingleton<GroupUseCase>()
.AddSingleton<UseCaseGeneratePresence>()
.AddSingleton<GroupConsoleUI>()
.AddSingleton<PresenceConsole>()
.AddSingleton<MainMenuUI>();
var serviceProvider = services.BuildServiceProvider();
// Создаем пользовательский интерфейс
MainMenuUI mainMenuUI = serviceProvider.GetService<MainMenuUI>();
// Выводим главное меню
mainMenuUI.DisplayMenu();