Files
obsidian-notes/2Areas/开发感悟/IOC.md
zzzisfunnyboy af39e07698 6.27
2025-06-27 00:36:51 +08:00

10 lines
548 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### 一些观念
- 面向接口编程
- IOC.Register注册的是工厂方法而不是实例
- 只有在获取的时候才是注册实例的时机
- 区别IOC获取实例的不是根据不同数据而获取不同的实例而是根据不同的区域获取不同的类型工厂
- 例子在某个业务中IOC注入的不是某个对象池的实例而是应该注入对象池是哪个
- 例子2:背包页面中需要某个Item的数据的时候应该通过IOC先注入背包管理类然后用背包管理类获取这个数据