agoda-com / agoda-com/AgodaAnalyzers
Blocking `IHttpContextAccessor` to be passed in constructors
- 主要语言
- C#
- 星标
- 25
- 派生
- 15
- PR 合并指标
- 30 天内没有已合并 PR
描述
https://github.com/agoda-com/AgodaAnalyzers/blob/a4849937ed4de79d8b1f3d3300f575c8c93e6eff/src/Agoda.Analyzers/RuleContent/AG0009IHttpContextAccessorCannotBePassedAsMethodArgument.html#L28-L31
In pipeline (eg middlewares) there are several use-cases where we need to inject `IHttpContextAccessor` as a dependency, usually in order to get access to the request object. While I agree that domain-logic user classes should not depend on this, I feel like this rule blocks some of our valid use-cases.
Can we change this rule to only apply to method parameters? (Yes, it opens up a hole that people might create a constructor just to have access to it, but that's why we have code-reviews...)
贡献指南
评估
这个 Issue 还没有评估数据。