From the course: Azure Functions for Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating the Startup class and injecting the dependency

Creating the Startup class and injecting the dependency - Azure Tutorial

From the course: Azure Functions for Developers

Start my 1-month free trial

Creating the Startup class and injecting the dependency

- To implement dependency injection in natural functions, we need to have a class that inherits from the functions startup base class, which can be found in the microservicio, functions, extensions you can package. So let's do that, let's have a new class here and let's name it startup. Actually the name doesn't matter, what matters is that we inherit from Functions Startup. As you can see, visual studio is very smart and is offering me a couple of options. In this case, I am going to use the first one, and let's implement this abstract class. This abstract class has only one member which is the configure method, and this is obtaining this Ifunctions Host Builder object. This is because the actual functions host creates an instance of these IFunctions Host Builder Objects, and passes it to the configure method. And we can use this object to register all the different services in the dependency injection container.…

Contents