Dependency Injection for Modules Using Containers

We will dive into a module to switch its composition root over to using the DI containers.

Using the di package in each of the modules is going to be the same, but for the examples of what needs to be updated, we are going to use the Depot module. We have chosen the Depot module because it uses every kind of event and message handler.

Container setup

We first create a new container at the start of the composition root Startup() method, like so:

Get hands-on with 1400+ tech skills courses.