You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public TestClass(Microsoft.AspNetCore.Http.IHttpContextAccessor context)
{
// this constructor is uglier
}
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...)
The text was updated successfully, but these errors were encountered:
AgodaAnalyzers/src/Agoda.Analyzers/RuleContent/AG0009IHttpContextAccessorCannotBePassedAsMethodArgument.html
Lines 28 to 31 in a484993
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...)
The text was updated successfully, but these errors were encountered: