using console_ui; using data; using data.Repository; using domain.Service; using domain.UseCase; using Microsoft.Extensions.DependencyInjection; void printAllGroups(IGroupRepository groupRepository) { foreach (var item in groupRepository.getAllGroup()) { Console.WriteLine($"{item.Id} {item.Name}"); } } IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection .AddDbContext() .AddSingleton() .AddSingleton() .AddSingleton(); var serivceProvider = serviceCollection.BuildServiceProvider(); var groupUi = serivceProvider.GetService(); groupUi?.AddGroup();