.NET Dependency Injection Patterns
Organizes and optimizes Microsoft.Extensions.DependencyInjection registrations using composable extension methods for cleaner and more maintainable .NET applications.
This skill provides expert guidance on implementing the 'Extension Method Composition' pattern for .NET dependency injection, helping developers move away from bloated Program.cs files by grouping related service registrations into modular, reusable, and testable modules. It outlines best practices for file organization, consistent naming conventions, and proper service lifetime management (Singleton, Scoped, Transient) while providing specific solutions for common pitfalls like capturing scoped services within singletons or managing scopes in background workers and Akka.NET actors. By standardizing how services are registered, teams can reduce merge conflicts, improve code discoverability, and ensure that production configurations are easily replicated in integration tests.