21 lines
720 B
C#
21 lines
720 B
C#
![]() |
using Microsoft.AspNetCore.Builder;
|
|||
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
|
|||
|
namespace VOL.Core.Extensions
|
|||
|
{
|
|||
|
public static class StaticHttpContextExtensions
|
|||
|
{
|
|||
|
//public static void AddHttpContextAccessor(this IServiceCollection services)
|
|||
|
//{
|
|||
|
// services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
|||
|
//}
|
|||
|
|
|||
|
public static IApplicationBuilder UseStaticHttpContext(this IApplicationBuilder app)
|
|||
|
{
|
|||
|
var httpContextAccessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
|
|||
|
Utilities.HttpContext.Configure(httpContextAccessor);
|
|||
|
return app;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|