pr1/presence/console_ui/Program.cs

39 lines
1017 B
C#
Raw Normal View History

2024-12-05 09:30:01 +00:00
using console_ui;
using data;
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.Repository;
2024-12-19 17:36:57 +00:00
using Demo.Domain.UseCase;
using Demo.UI;
2024-12-05 09:30:01 +00:00
using domain.Service;
using domain.UseCase;
using Microsoft.Extensions.DependencyInjection;
void printAllGroups(IGroupRepository groupRepository)
{
2024-12-19 17:36:57 +00:00
foreach (var item in groupRepository.GetAllGroup())
2024-12-05 09:30:01 +00:00
{
Console.WriteLine($"{item.Id} {item.Name}");
}
}
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection
.AddDbContext<RemoteDatabaseContext>()
2024-12-19 17:36:57 +00:00
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<UserUseCase>()
.AddSingleton<GroupUseCase>()
.AddSingleton<PresenceUseCase>()
.AddSingleton<MainMenuUI>();
2024-12-05 09:30:01 +00:00
var serivceProvider = serviceCollection.BuildServiceProvider();
var groupUi = serivceProvider.GetService<GroupUI>();
groupUi?.AddGroup();