presence123/Demo/Program.cs

29 lines
934 B
C#
Raw Permalink Normal View History

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