A key point to master when we deal with dependency injection is the services life cycle. The services life cycle is an essential concept about performance, because a wrong service life cycle may cause complicated performance degradation.
The object lifetime in .NET is simple: the object is instantiated, used, and finally disposed of by the garbage collector. The dispose phase is the most relevant in terms of performance. In a dependency injection process, the consumer of a specific dependency does not control its lifetime. Indeed, dependencies are usually initialized by the dependency injection container, and they continue to exist until all their consumers hold them.
Speaking of dependency injection, the default life cycle types in ASP.NET Core are transient, scoped, and singleton. Let's discuss them more in detail.