Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
I discovered that I couldn't access the HttpContext in a DI based way. Not sure if this support was excluded for some reason (or I've completely gone about it the wrong way :)
// Setup HttpContext if services has been added with AddHttpContextAccessor
var httpContext = (IHttpContextAccessor)ctx.RequestServices.GetService(typeof(IHttpContextAccessor));
if (httpContext != null)
{
httpContext.HttpContext = ctx;
}
This solves my particular issue but would this be wanted in the main repo? If so I'll make a PR
I discovered that I couldn't access the HttpContext in a DI based way. Not sure if this support was excluded for some reason (or I've completely gone about it the wrong way :)
I added the following before https://github.com/CarterCommunity/Carter/blob/master/src/Carter/CarterExtensions.cs#L86
This solves my particular issue but would this be wanted in the main repo? If so I'll make a PR