Understanding service lifetimes is the difference between a bug-free app and one that has massive data corruption in production.
A new instance is created **Every Time** it is requested. Best for lightweight, stateless services like a logging helper or an email formatter.
A new instance is created once per **HTTP Request**. All components in that same request share the same instance. This is Mandatory for DbContexts and UserContexts.
One instance is created once, and it **Never Dies** until the server restarts. Best for caching engines or global configuration handlers.
Never inject a Scoped service into a Singleton. This is a Captive Dependencyβthe singleton will "capture" the scoped instance and keep it alive forever, leading to catastrophic database connection leaks and data corruption. This is an immediate fail in any architect-level interview.