Dependency Injection
Core Principles
Constructor injection is the default
— Inject dependencies through the constructor (primary constructors make this clean). No service locator, no property injection.
Match lifetimes carefully
— A singleton must never depend on a scoped or transient service. This is the most common DI bug.
Register interfaces, resolve interfaces
— Register
services.AddScoped
dependency-injection
安装
npx skills add https://github.com/codewithmukesh/dotnet-claude-kit --skill dependency-injection