Beispiel #1
0
        private async Task <ServiceProvider> ConfigureServicesAsync(Database database)
        {
            DiscordSocketClient client = new DiscordSocketClient();

            Container playersRepositoryContainer = await PlayersRepository.CreateContainer(database);

            PlayersRepository playersRepository = new PlayersRepository(playersRepositoryContainer);

            Container adventuresRepositoryContainer = await AdventuresRepository.CreateContainer(database);

            AdventuresRepository adventuresRepository = new AdventuresRepository(adventuresRepositoryContainer);

            TickService tickService = new TickService(playersRepository, adventuresRepository);
            UIService   uiService   = new UIService(client, playersRepository, adventuresRepository);

            return(new ServiceCollection()
                   .AddSingleton(client)
                   .AddSingleton <CommandService>()
                   .AddSingleton <CommandHandlingService>()
                   .AddSingleton <HttpClient>()
                   .AddSingleton(tickService)
                   .AddSingleton(uiService)
                   .AddSingleton(playersRepository)
                   .AddSingleton(adventuresRepository)
                   .BuildServiceProvider());
        }