Search code examples
azureinversion-of-controlazure-functions

using IoC container in azure functions


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

  1. scan and register on start of a service
  2. use nested container for each ticket / request

How can I use IOC in an azure function call ? Should I be using it at all ?


Solution

  • 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.