Using external IoC containers
ASP.NET Core 5 provides an extensible built-in IoC container out of the box. It is not the most powerful IoC container because it lacks some advanced features, but it can do the job for most applications. Rest assured, if it does not, you can change it for another. You might want to do that if you are used to another IoC container and want to stick to it or need missing advanced features.
As of today, Microsoft recommends using the built-in container first. If you don't know ahead of time all of the DI features that you will need, I'd go with the following strategy:
- Use the built-in container.
- When something cannot be done with it, look at your design and see if you can redesign your feature to work with the built-in container. This could help simplify your design, and at the same time, help maintain your software in the long run.
- If it is impossible to achieve your goal, then swap it for another IoC container.
Assuming...