ASP.Net Core comes with built-in support for dependency injection. In fact, ASP.Net Core comes with a minimalistic dependency injection container out of the box. However, you can also use third-party dependency injection containers in ASP.Net Core.
Dependency injection is a design pattern that facilitates loose coupling and promotes testability and maintenance. You can take advantage of dependency injection to improve your implementations without having to change the classes or interfaces that use those implementations.
Lamar is a fast, modernized successor of the popular inversion-of-control (IoC) container StructureMap. This article discusses how we can work with Lamar in ASP.Net Core.
Why use Lamar for dependency injection
The main drawback of StructureMap was performance. Lamar is lightweight and fast. Lamar also has a powerful API that enables you to explore and leverage its features easily. The Lamar API is similar to StructureMap, so if you have used StructureMap in the past you will be able to use Lamar with ease.