
IServiceCollection Explained FAST | ASP.NET Dependency Injection
IServiceCollection explained in under a minute. š It's your app's service registry ā a catalog of every dependency your .NET app can use. You register services in Program.cs with AddSingleton, AddScoped, or AddTransient, and .NET builds a ServiceProvider that injects them into your classes automatically. ā¶ Service lifetimes: ⢠Singleton ā one instance for the whole app ⢠Scoped ā one instance per request ⢠Transient ā a new instance every time That's dependency injection: clean, testable, decoupled code ā no "new" keyword, no tight coupling. Follow for more .NET & C# shorts! š #dotnet #csharp #dependencyinjection Quick recap š Singleton = one for the whole app Scoped = one per request Transient = new every time What .NET topic should I cover next?