MVVM Toolkit 依赖注入
原名:mvvm-toolkit-di
为使用 CommunityToolkit.Mvvm 的应用设计清楚的服务注册、生命周期和测试替身。
中文 Skills 技能说明
适合 .NET 桌面或跨平台应用改善模块边界。服务生命周期必须结合线程和资源使用决定,不滥用全局单例;敏感配置通过受控配置源注入。
上游能力依据
上游原始适用说明:Wire CommunityToolkit.Mvvm ViewModels into Microsoft.Extensions.DependencyInjection. Covers the .NET Generic Host composition root, constructor injection, service lifetimes (Singleton / Transient / Scoped), IMessenger registration, resolving ViewModels in Views, keyed services, testing seams, and the legacy Ioc.Default escape hatch. Use across WPF, WinUI 3, .NET MAUI, Uno, and Avalonia.
上游 SKILL.md 主要章节(保留原文标题):
- When to use this skill
- Recommended composition root (Generic Host)
- Without Generic Host
- Constructor injection
- Lifetimes
- Resolving in a View
- IMessenger registration
- Keyed services (.NET 8+)
- Testing seams
- Legacy: Ioc.Default
使用边界
先读取项目约定、依赖版本和现有测试,再提出最小改动。写文件、运行脚本、提交代码或发布前应检查差异并保留回退路径。
作者、翻译与许可证
- 原作者
- GitHub, Inc. 与 awesome-copilot contributors
- 中文翻译
- CEOFans翻译
- 许可证
- MIT
- 上游来源
- https://github.com/github/awesome-copilot/tree/3f0bba475ec40b9680e1d0311b9caffeec5ad4c3/skills/mvvm-toolkit-di
适用范围
平台:linux、macos、windows;标签:软件开发、MVVM Toolkit 依赖注入
安全提示
基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。
如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。