Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created April 1, 2018 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/3ea0365d7d3024ea78857017dff9b0fe to your computer and use it in GitHub Desktop.
Save justinyoo/3ea0365d7d3024ea78857017dff9b0fe to your computer and use it in GitHub Desktop.
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