Explain DI lifetimes: Transient, Scoped, Singleton.

Senior .NET Core

Answer

Transient: New instance each request.
Scoped: One instance per HTTP request.
Singleton: One instance for entire app lifetime.

Wrong lifetimes cause concurrency bugs, memory leaks, or stale state.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice