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