Created
April 1, 2018 14:38
-
-
Save justinyoo/1b6dc3f68ff6fda34ac73a9a878416d6 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 ContainerBuilder : IContainerBuilder | |
{ | |
private readonly IServiceCollection _services; | |
public ContainerBuilder() | |
{ | |
this._services = new ServiceCollection(); | |
} | |
public IContainerBuilder RegisterModule(IModule module = null) | |
{ | |
if (module == null) | |
{ | |
module = new Module(); | |
} | |
module.Load(this._services); | |
return this; | |
} | |
public IServiceProvider Build() | |
{ | |
var provider = this._services.BuildServiceProvider(); | |
return provider; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment