Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dependency Injections on Azure Functions V2
public class CoreAppModule : Module
{
public override void Load(IServiceCollection services)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("config.json")
.Build();
var github = config.Get<GitHub>("github");
services.AddSingleton(github);
services.AddSingleton<HttpClient>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment