protected async Task CommandAsync(CancellationToken cancellationToken) { using (IServiceScope scope = new ServiceCollection().AddCoreServices(cancellationToken, typeof(HeroesProfileProvider)).BuildServiceProvider().CreateScope()) { SaltySadism saltySadism = scope.ServiceProvider.GetRequiredService <SaltySadism>(); await saltySadism.RunAsync(); } }
protected async Task CommandAsync(CancellationToken cancellationToken) { using (IServiceScope scope = new ServiceCollection().AddCoreServices(cancellationToken, typeof(ReplayDirectoryProvider)).BuildServiceProvider(new ServiceProviderOptions { ValidateScopes = true, ValidateOnBuild = true }).CreateScope()) { SaltySadism saltySadism = scope.ServiceProvider.GetRequiredService <SaltySadism>(); await saltySadism.RunAsync(); } }