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.
77 lines
2.1 KiB
77 lines
2.1 KiB
2 years ago
|
|
||
|
using Microsoft.AspNetCore.Builder;
|
||
|
|
||
|
namespace Znyc.CloudCar.Middlewares
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 中间件
|
||
|
/// </summary>
|
||
|
public static class MiddlewareHelpers
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 请求响应中间件
|
||
|
/// </summary>
|
||
|
/// <param name="app"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IApplicationBuilder UseRequestResponseLog(this IApplicationBuilder app)
|
||
|
{
|
||
|
return app.UseMiddleware<RequRespLogMildd>();
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 异常处理中间件(后端模式)
|
||
|
/// </summary>
|
||
|
/// <param name="app"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IApplicationBuilder UseExceptionHandlerMiddForAdmin(this IApplicationBuilder app)
|
||
|
{
|
||
|
return app.UseMiddleware<ExceptionHandlerMid>();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 异常处理中间件(客户端)
|
||
|
/// </summary>
|
||
|
/// <param name="app"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IApplicationBuilder UseExceptionHandlerMiddForClent(this IApplicationBuilder app)
|
||
|
{
|
||
|
return app.UseMiddleware<ExceptionHandlerMid>();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// SignalR中间件
|
||
|
/// </summary>
|
||
|
/// <param name="app"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IApplicationBuilder UseSignalRSendMildd(this IApplicationBuilder app)
|
||
|
{
|
||
|
return app.UseMiddleware<SignalRSendMildd>();
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// IP请求中间件
|
||
|
/// </summary>
|
||
|
/// <param name="app"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IApplicationBuilder UseIpLogMildd(this IApplicationBuilder app)
|
||
|
{
|
||
|
return app.UseMiddleware<IPLogMildd>();
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 用户访问接口日志中间件
|
||
|
/// </summary>
|
||
|
/// <param name="app"></param>
|
||
|
/// <returns></returns>
|
||
|
public static IApplicationBuilder UseRecordAccessLogsMildd(this IApplicationBuilder app)
|
||
|
{
|
||
|
return app.UseMiddleware<RecordAccessLogsMildd>();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|