In .NET Core, you can register dependencies using three different methods AddSingleton, AddTransient, and AddScoped. This blog explains each of these methods.
Objects injected using Dependency Injection have a specific lifetime. Object's lifetime depends on how you register dependency. To understand how each method is different from than others we will create a console application, and service and inject this service to application middleware.
For more information please visit https://geeksarray.com/blog/net-core-dependency-injection-object-lifetime