agoda-com / agoda-com/AgodaAnalyzers
Blocking `IHttpContextAccessor` to be passed in constructors
- Vorherrschende Sprache
- C#
- Sterne
- 25
- Forks
- 15
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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...)
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.