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