I’m trying to understand how dependency injection fits into an ASP.NET Core application. I’ve seen services registered in Program.cs and then passed into controllers or other classes through their constructors, but I’m not clear on what the framework is doing behind the scenes.
How does ASP.NET Core dependency injection resolve those services, and how should I think about the different service lifetimes—Transient, Scoped, and Singleton? I’m especially interested in when choosing the wrong lifetime can cause problems.