presence/ConsoleUI/Program.cs
Class_Student e771fe1659 new
2024-12-06 11:51:13 +03:00

19 lines
737 B
C#

using presence.Data.RemoteData.RemoteDatabase;
using presence.Data.Repository;
using presence.Domain.UseCase;
using presence.UI;
using Microsoft.Extensions.DependencyInjection;
IServiceCollection services = new ServiceCollection();
services
.AddSingleton<UserUseCase>()
.AddSingleton<GroupUseCase>()
.AddSingleton<PresenceUseCase>()
.AddSingleton<MainMenuUI>()
.AddDbContext<RemoteDatabaseContext>()
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>();
var serviceProvider = services.BuildServiceProvider();
var mainMenuUI = serviceProvider.GetRequiredService<MainMenuUI>();