·dependency-injection-patterns
</>

dependency-injection-patterns

aaronontheweb/dotnet-skills

使用 IServiceCollection 扩展方法组织 DI 注册。将相关服务分组为可组合的 Add* 方法,以实现干净的 Program.cs 和测试中可重用的配置。

29安装·3热度·@aaronontheweb

安装

$npx skills add https://github.com/aaronontheweb/dotnet-skills --skill dependency-injection-patterns

SKILL.md

Convention: {Feature}ServiceCollectionExtensions.cs next to the feature's services.

| Add{Feature}Services() | General feature registration | | Add{Feature}() | Short form when unambiguous | | Configure{Feature}() | When primarily setting options | | Use{Feature}() | Middleware (on IApplicationBuilder) |

See akka/hosting-actor-patterns skill for complete Akka.Hosting patterns.

使用 IServiceCollection 扩展方法组织 DI 注册。将相关服务分组为可组合的 Add* 方法,以实现干净的 Program.cs 和测试中可重用的配置。 来源:aaronontheweb/dotnet-skills。

查看原文

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/aaronontheweb/dotnet-skills --skill dependency-injection-patterns
分类
</>开发工具
认证
收录时间
2026-02-05
更新时间
2026-02-18

快速解答

什么是 dependency-injection-patterns?

使用 IServiceCollection 扩展方法组织 DI 注册。将相关服务分组为可组合的 Add* 方法,以实现干净的 Program.cs 和测试中可重用的配置。 来源:aaronontheweb/dotnet-skills。

如何安装 dependency-injection-patterns?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/aaronontheweb/dotnet-skills --skill dependency-injection-patterns 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用

这个 Skill 的源码在哪?

https://github.com/aaronontheweb/dotnet-skills