You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
657 B
19 lines
657 B
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Tiobon.Core.Common;
|
|
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>();
|
|
HttpUseContext.Configure(httpContextAccessor);
|
|
return app;
|
|
}
|
|
} |