基类InvokeNextBefore和InvokeNextAfter方法改为virtual方法,这样子类不必重写所有两个方法
This commit is contained in:
parent
a0f3d367f0
commit
86e03c09cf
|
@ -10,10 +10,17 @@ namespace Falcon.Middleware.Test
|
|||
public MiddlewareTest(RequestDelegate next) : base(next) {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在调用next之后执行
|
||||
/// </summary>
|
||||
/// <param name="context">请求上下文</param>
|
||||
public async override void InvokeNextAfter(HttpContext context) {
|
||||
await context.Response.WriteAsync("\nInvokeNextAfter");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在调用next之前执行
|
||||
/// </summary>
|
||||
/// <param name="context">请求上下文</param>
|
||||
public async override void InvokeNextBefore(HttpContext context) {
|
||||
await context.Response.WriteAsync("InvokeNextBefore\n");
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ namespace Falcon.Middleware
|
|||
/// 在执行下一个中间件之前执行
|
||||
/// </summary>
|
||||
/// <param name="context">请求上下文</param>
|
||||
public abstract void InvokeNextBefore(HttpContext context);
|
||||
public virtual void InvokeNextBefore(HttpContext context) { }
|
||||
/// <summary>
|
||||
/// 在执行下一个中间件之后执行
|
||||
/// </summary>
|
||||
/// <param name="context">请求上下文</param>
|
||||
public abstract void InvokeNextAfter(HttpContext context);
|
||||
public virtual void InvokeNextAfter(HttpContext context) { }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user