Created
September 7, 2021 19:02
-
-
Save WolfgangOfner/a0bc95521a077a0922057d97c7002460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GreetWithDependencyInjection(IServiceProvider services) | |
{ | |
using var serviceScope = services.CreateScope(); | |
var provider = serviceScope.ServiceProvider; | |
var greeter = provider.GetRequiredService<IGreeter>(); | |
return greeter.Greet(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment