It depends: .NET Core dependency injection
summary
Default .NET Core DI is wired into apps so a bare ASP.NET Core 3.0 project already registers 265 registrations and uses constructor injection with three lifetimes singleton scoped transient. Background workers must create scopes with IServiceScopeFactory or singletons resolve transients into the root provider and cause memory leaks. Custom containers plug in via IServiceProviderFactory or by returning an IServiceProvider from ConfigureServices. Enable runtime checks like ValidateOnBuild or ValidateScopes to catch circular dependencies and invalid lifetime mixes before they hit production.
AI-written summary · about
chapters (10)
- 0:00Intro
- 1:45Why do you need dependency injection?
- 4:54Dependency injection at work
- 12:57Registering and mapping service types
- 14:49Lifetime of resolved objects
- 16:37Startup dass Typical startup in ASPNET Core
- 25:46Hosting in .NET Core 3.0 Hosting outside and without ASPNET Core
- 36:47Custom service providers
- 43:18Convention based startup Different regstrations for environments
- 45:22Validation of scopes
related talks
55mASP.NET Core's Built-in Dependency Injection Framework
16mInterview Speaker
01h 01mASP.NET Core Deep(er) Dive
01h 01mASP.NET Basics for Experts
01h 00m.NET: Dependency Therapy
01h 00mDiagnosing issues in ASP.NET Core Applications
01h 02mIs your code ready for .NET Core?
01h 02mPatterns for application development with ASP.NET Core
