问题
I have been used to writing Windows Services using TopShelf to do all stuff which cannot be done in a web request and am slowly moving to using azure functions.
With topshelf I could generally do
- scan and register on start of a service
- use nested container for each ticket / request
How can I use IOC in an azure function call ? Should I be using it at all ?
回答1:
No there isn't currently a way to do IOC in a natural way in Azure Functions. Generally you'd want to initialize your IOC container at application startup, but we don't currently give you a way to do that. We have an open issue in our repo related to that here. Furthermore, we'd have to make this container available to Function instances.
来源:https://stackoverflow.com/questions/40430342/using-ioc-container-in-azure-functions