IAuthorizationFilter.ExecuteAuthorizationFilterAsync中的延续可以为空吗?

时间:2019-06-13 08:11:26

标签: c# asp.net

我有一个像这样的标准ASP.NET身份验证过滤器实现。

public async Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext context, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
{
       await OnAuthorizeAsync(context);
       return context.Response ?? await continuation();
}

continuation是否可以在null中成为IAuthorizationFilter.ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation),我应该添加空检查吗?

0 个答案:

没有答案