-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Injection 提供可溯源的能力 #176
Labels
Comments
默认抛错,然后有选项可以覆盖是不是比较好 |
默认抛错还是覆盖,和昨天的讨论其实一样,需要明确一下大部分场景是允许覆盖还是不允许覆盖,这个我目前倒是没有什么想法 |
+1 |
觉得默认抛错,然后覆盖比较好,这里应该把用法大部分场景这个点优先级降低,更多考虑安全稳定,即使大部分场景是覆盖,默认报错会导致写代码比较累,但是我仍然推荐默认报错,这种主动感知更好 |
目前的讨论比较统一,那就默认抛错,覆盖需要增加选项 |
这是 2 个能力吧,抛错是一种处理方式。 |
溯源后续可以考虑提供依赖图分析 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
背景
目前
@artus/injection
提供的 Container,允许同 Id 或者同 Type 覆盖,从 IoC 容器的设计上说这种行为是合理的,但是额外的,需要由injection
模块提供溯源的机制,以便在用户误覆盖上层框架内置的实体时可以由上层框架自行决定给出 warning 提示或者 throw 中断处理。更多的,是否有必要在
injection
提供的 Container 中直接内置可选的属性override
,来保证 set 之后不允许覆盖。The text was updated successfully, but these errors were encountered: