In all examples that i've seen of IHttpContextAccessor
injection, it is set as a Singleton.
Examples:
How to add IHttpContextAccessor in the Startup class in the DI in ASP.NET Core 1.0? Injecting IHttpContextAccessor into ApplicationDbContext ASP.NET Core 1.0 .NET Core IHttpContextAccessor issue
I find it kinda weird, since HttpContext
really looks like something that maps to requests. Wouldn't AddScoped
be more appropriate in this case?
Is Singleton really the recomended way? Am I not seeeing something?