Created
April 1, 2018 14:48
-
-
Save justinyoo/ea68d349fc3955154d71ce6b28d3144a to your computer and use it in GitHub Desktop.
Dependency Injections on Azure Functions V2
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 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>(); | |
services.AddTransient<IGitHubRepositoriesFunction, CoreGitHubRepositoriesFunction>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment