Don't invoke async state machine unnecessarily

Return task rather than awaiting when no extra work needs to be done
after await
This commit is contained in:
Ben Adams 2015-08-31 03:30:16 +01:00 committed by Ryan Nowak
parent 98b3f055e1
commit 55fc7ded36
23 changed files with 120 additions and 101 deletions

View File

@ -14,12 +14,11 @@ namespace Microsoft.AspNet.Mvc
{
public int Order { get; set; }
#pragma warning disable 1998
public virtual async Task OnAuthorizationAsync([NotNull] AuthorizationContext context)
public virtual Task OnAuthorizationAsync([NotNull] AuthorizationContext context)
{
OnAuthorization(context);
return TaskCache.CompletedTask;
}
#pragma warning restore 1998
public virtual void OnAuthorization([NotNull] AuthorizationContext context)
{

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Mvc
/// </summary>
public int? StatusCode { get; set; }
public override async Task ExecuteResultAsync([NotNull] ActionContext context)
public override Task ExecuteResultAsync([NotNull] ActionContext context)
{
var response = context.HttpContext.Response;
var contentTypeHeader = ContentType;
@ -54,8 +54,9 @@ namespace Microsoft.AspNet.Mvc
if (Content != null)
{
await response.WriteAsync(Content, contentTypeHeader?.Encoding ?? DefaultContentType.Encoding);
return response.WriteAsync(Content, contentTypeHeader?.Encoding ?? DefaultContentType.Encoding);
}
return TaskCache.CompletedTask;
}
}
}

View File

@ -25,16 +25,16 @@ namespace Microsoft.AspNet.Mvc
return CastToObject<T>(task);
}
public static async Task<object> ExecuteAsync(
public static Task<object> ExecuteAsync(
MethodInfo actionMethodInfo,
object instance,
IDictionary<string, object> actionArguments)
{
var orderedArguments = PrepareArguments(actionArguments, actionMethodInfo.GetParameters());
return await ExecuteAsync(actionMethodInfo, instance, orderedArguments);
return ExecuteAsync(actionMethodInfo, instance, orderedArguments);
}
public static async Task<object> ExecuteAsync(
public static Task<object> ExecuteAsync(
MethodInfo actionMethodInfo,
object instance,
object[] orderedActionArguments)
@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Mvc
exceptionDispatchInfo.Throw();
}
return await CoerceResultToTaskAsync(
return CoerceResultToTaskAsync(
invocationResult,
actionMethodInfo.ReturnType,
actionMethodInfo.Name,

View File

@ -12,12 +12,11 @@ namespace Microsoft.AspNet.Mvc
{
public int Order { get; set; }
#pragma warning disable 1998
public virtual async Task OnExceptionAsync([NotNull] ExceptionContext context)
public virtual Task OnExceptionAsync([NotNull] ExceptionContext context)
{
OnException(context);
return TaskCache.CompletedTask;
}
#pragma warning restore 1998
public virtual void OnException([NotNull] ExceptionContext context)
{

View File

@ -186,12 +186,12 @@ namespace Microsoft.AspNet.Mvc.Core
return context.Results.Select(item => item.Filter).Where(filter => filter != null).ToArray();
}
private async Task InvokeAllAuthorizationFiltersAsync()
private Task InvokeAllAuthorizationFiltersAsync()
{
_cursor.SetStage(FilterStage.AuthorizationFilters);
_authorizationContext = new AuthorizationContext(ActionContext, _filters);
await InvokeAuthorizationFilterAsync();
return InvokeAuthorizationFilterAsync();
}
private async Task InvokeAuthorizationFilterAsync()
@ -236,7 +236,7 @@ namespace Microsoft.AspNet.Mvc.Core
}
}
private async Task InvokeAllResourceFiltersAsync()
private Task InvokeAllResourceFiltersAsync()
{
_cursor.SetStage(FilterStage.ResourceFilters);
@ -249,7 +249,7 @@ namespace Microsoft.AspNet.Mvc.Core
context.ValueProviderFactories = new CopyOnWriteList<IValueProviderFactory>(_valueProviderFactories);
_resourceExecutingContext = context;
await InvokeResourceFilterAsync();
return InvokeResourceFilterAsync();
}
private async Task<ResourceExecutedContext> InvokeResourceFilterAsync()
@ -397,11 +397,11 @@ namespace Microsoft.AspNet.Mvc.Core
return _resourceExecutedContext;
}
private async Task InvokeAllExceptionFiltersAsync()
private Task InvokeAllExceptionFiltersAsync()
{
_cursor.SetStage(FilterStage.ExceptionFilters);
await InvokeExceptionFilterAsync();
return InvokeExceptionFilterAsync();
}
private async Task InvokeExceptionFilterAsync()
@ -654,24 +654,9 @@ namespace Microsoft.AspNet.Mvc.Core
{
await item.FilterAsync.OnResultExecutionAsync(_resultExecutingContext, InvokeResultFilterAsync);
if (_resultExecutedContext == null)
if (_resultExecutedContext == null || _resultExecutingContext.Cancel == true)
{
// Short-circuited by not calling next
_logger.LogVerbose(ResourceFilterShortCircuitLogMessage, item.FilterAsync.GetType().FullName);
_resultExecutedContext = new ResultExecutedContext(
_resultExecutingContext,
_filters,
_resultExecutingContext.Result,
Instance)
{
Canceled = true,
};
}
else if (_resultExecutingContext.Cancel == true)
{
// Short-circuited by setting Cancel == true
// Short-circuited by not calling next || Short-circuited by setting Cancel == true
_logger.LogVerbose(ResourceFilterShortCircuitLogMessage, item.FilterAsync.GetType().FullName);

View File

@ -146,9 +146,9 @@ namespace Microsoft.AspNet.Mvc
FlushInternal(true, true);
}
public override async Task FlushAsync()
public override Task FlushAsync()
{
await FlushInternalAsync(true, true);
return FlushInternalAsync(flushStream: true, flushEncoder: true);
}
// Do not flush the stream on Dispose, as this will cause response to be

View File

@ -82,15 +82,15 @@ namespace Microsoft.AspNet.Mvc
}
/// <inheritdoc />
public virtual async Task<object> ReadAsync(InputFormatterContext context)
public virtual Task<object> ReadAsync(InputFormatterContext context)
{
var request = context.HttpContext.Request;
if (request.ContentLength == 0)
{
return GetDefaultValueForType(context.ModelType);
return Task.FromResult(GetDefaultValueForType(context.ModelType));
}
return await ReadRequestBodyAsync(context);
return ReadRequestBodyAsync(context);
}
/// <summary>

View File

@ -189,13 +189,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
}
// Used when the ValueProvider contains the collection to be bound as multiple elements, e.g. foo[0], foo[1].
private async Task<CollectionResult> BindComplexCollection(ModelBindingContext bindingContext)
private Task<CollectionResult> BindComplexCollection(ModelBindingContext bindingContext)
{
var indexPropertyName = ModelNames.CreatePropertyModelName(bindingContext.ModelName, "index");
var valueProviderResultIndex = bindingContext.ValueProvider.GetValue(indexPropertyName);
var indexNames = GetIndexNamesFromValueProviderResult(valueProviderResultIndex);
return await BindComplexCollectionFromIndexes(bindingContext, indexNames);
return BindComplexCollectionFromIndexes(bindingContext, indexNames);
}
// Internal for testing.

View File

@ -101,7 +101,7 @@ namespace Microsoft.AspNet.Mvc
}
}
private async Task InvokeActionAsync(RouteContext context, ActionDescriptor actionDescriptor)
private Task InvokeActionAsync(RouteContext context, ActionDescriptor actionDescriptor)
{
var actionContext = new ActionContext(context.HttpContext, context.RouteData, actionDescriptor);
_actionContextAccessor.ActionContext = actionContext;
@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Mvc
actionDescriptor.DisplayName));
}
await invoker.InvokeAsync();
return invoker.InvokeAsync();
}
private void EnsureServices(HttpContext context)

View File

@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Mvc
/// </summary>
public int? StatusCode { get; set; }
public override async Task ExecuteResultAsync(ActionContext context)
public override Task ExecuteResultAsync(ActionContext context)
{
var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<ObjectResult>>();
@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Mvc
logger.LogWarning("No output formatter was found to write the response.");
context.HttpContext.Response.StatusCode = StatusCodes.Status406NotAcceptable;
return;
return TaskCache.CompletedTask;
}
logger.LogVerbose(
@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Mvc
}
OnFormatting(context);
await selectedFormatter.WriteAsync(formatterContext);
return selectedFormatter.WriteAsync(formatterContext);
}
public virtual IOutputFormatter SelectFormatter(

View File

@ -158,10 +158,10 @@ namespace Microsoft.AspNet.Mvc
}
/// <inheritdoc />
public async Task WriteAsync([NotNull] OutputFormatterContext context)
public Task WriteAsync([NotNull] OutputFormatterContext context)
{
WriteResponseHeaders(context);
await WriteResponseBodyAsync(context);
return WriteResponseBodyAsync(context);
}
/// <summary>

View File

@ -37,17 +37,17 @@ namespace Microsoft.AspNet.Mvc
return false;
}
public override async Task WriteResponseBodyAsync(OutputFormatterContext context)
public override Task WriteResponseBodyAsync(OutputFormatterContext context)
{
var valueAsString = (string)context.Object;
if (string.IsNullOrEmpty(valueAsString))
{
return;
return TaskCache.CompletedTask;
}
var response = context.HttpContext.Response;
await response.WriteAsync(valueAsString, context.SelectedEncoding);
return response.WriteAsync(valueAsString, context.SelectedEncoding);
}
}
}

View File

@ -0,0 +1,29 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace Microsoft.AspNet.Mvc
{
public static class TaskCache
{
#if DNX451
static readonly Task _completedTask = Task.FromResult(0);
#endif
/// <summary>Gets a task that's already been completed successfully.</summary>
/// <remarks>May not always return the same instance.</remarks>
public static Task CompletedTask
{
get
{
#if DNX451
return _completedTask;
#else
return Task.CompletedTask;
#endif
}
}
}
}

View File

@ -74,7 +74,6 @@ namespace Microsoft.AspNet.Mvc
// If this was a preflight, there is no need to run anything else.
// Also the response is always 200 so that anyone after mvc can handle the pre flight request.
context.Result = new HttpStatusCodeResult(StatusCodes.Status200OK);
await Task.FromResult(true);
}
// Continue with other filters and action.

View File

@ -294,9 +294,9 @@ namespace Microsoft.AspNet.Mvc.Razor
/// <returns>
/// A <see cref="Task"/> that on completion writes the <paramref name="tagHelperExecutionContext"/> content.
/// </returns>
public async Task WriteTagHelperAsync([NotNull] TagHelperExecutionContext tagHelperExecutionContext)
public Task WriteTagHelperAsync([NotNull] TagHelperExecutionContext tagHelperExecutionContext)
{
await WriteTagHelperToAsync(Output, tagHelperExecutionContext);
return WriteTagHelperToAsync(Output, tagHelperExecutionContext);
}
/// <summary>
@ -773,10 +773,10 @@ namespace Microsoft.AspNet.Mvc.Razor
/// value does not represent the rendered content.</remarks>
/// <exception cref="InvalidOperationException">if <paramref name="required"/> is <c>true</c> and the section
/// was not registered using the <c>@section</c> in the Razor page.</exception>
public async Task<HtmlString> RenderSectionAsync([NotNull] string name, bool required)
public Task<HtmlString> RenderSectionAsync([NotNull] string name, bool required)
{
EnsureMethodCanBeInvoked(nameof(RenderSectionAsync));
return await RenderSectionAsyncCore(name, required);
return RenderSectionAsyncCore(name, required);
}
private async Task<HtmlString> RenderSectionAsyncCore(string sectionName, bool required)

View File

@ -125,7 +125,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}
}
private async Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
private Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
{
page.IsPartial = IsPartial;
page.ViewContext = context;
@ -135,7 +135,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}
_pageActivator.Activate(page, context);
await page.ExecuteAsync();
return page.ExecuteAsync();
}
private async Task RenderViewStartAsync(ViewContext context)

View File

@ -1083,7 +1083,8 @@ namespace Microsoft.AspNet.Mvc
/// <param name="model">The model instance to update.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public virtual Task<bool> TryUpdateModelAsync<TModel>([NotNull] TModel model)
public virtual Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model)
where TModel : class
{
return TryUpdateModelAsync(model, prefix: string.Empty);
@ -1099,8 +1100,9 @@ namespace Microsoft.AspNet.Mvc
/// </param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public virtual async Task<bool> TryUpdateModelAsync<TModel>([NotNull] TModel model,
[NotNull] string prefix)
public virtual Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model,
[NotNull] string prefix)
where TModel : class
{
if (BindingContext == null)
@ -1111,7 +1113,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await TryUpdateModelAsync(model, prefix, BindingContext.ValueProvider);
return TryUpdateModelAsync(model, prefix, BindingContext.ValueProvider);
}
/// <summary>
@ -1125,9 +1127,10 @@ namespace Microsoft.AspNet.Mvc
/// <param name="valueProvider">The <see cref="IValueProvider"/> used for looking up values.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public virtual async Task<bool> TryUpdateModelAsync<TModel>([NotNull] TModel model,
[NotNull] string prefix,
[NotNull] IValueProvider valueProvider)
public virtual Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model,
[NotNull] string prefix,
[NotNull] IValueProvider valueProvider)
where TModel : class
{
if (BindingContext == null)
@ -1138,7 +1141,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
prefix,
ActionContext.HttpContext,
@ -1163,7 +1166,7 @@ namespace Microsoft.AspNet.Mvc
/// which need to be included for the current model.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public async Task<bool> TryUpdateModelAsync<TModel>(
public Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model,
string prefix,
[NotNull] params Expression<Func<TModel, object>>[] includeExpressions)
@ -1177,7 +1180,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
prefix,
ActionContext.HttpContext,
@ -1202,7 +1205,7 @@ namespace Microsoft.AspNet.Mvc
/// <param name="predicate">A predicate which can be used to filter properties at runtime.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public async Task<bool> TryUpdateModelAsync<TModel>(
public Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model,
string prefix,
[NotNull] Func<ModelBindingContext, string, bool> predicate)
@ -1216,7 +1219,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
prefix,
ActionContext.HttpContext,
@ -1243,7 +1246,7 @@ namespace Microsoft.AspNet.Mvc
/// which need to be included for the current model.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public async Task<bool> TryUpdateModelAsync<TModel>(
public Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model,
string prefix,
[NotNull] IValueProvider valueProvider,
@ -1258,7 +1261,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
prefix,
ActionContext.HttpContext,
@ -1284,7 +1287,7 @@ namespace Microsoft.AspNet.Mvc
/// <param name="predicate">A predicate which can be used to filter properties at runtime.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public async Task<bool> TryUpdateModelAsync<TModel>(
public Task<bool> TryUpdateModelAsync<TModel>(
[NotNull] TModel model,
string prefix,
[NotNull] IValueProvider valueProvider,
@ -1299,7 +1302,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
prefix,
ActionContext.HttpContext,
@ -1323,9 +1326,10 @@ namespace Microsoft.AspNet.Mvc
/// </param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public virtual async Task<bool> TryUpdateModelAsync([NotNull] object model,
[NotNull] Type modelType,
string prefix)
public virtual Task<bool> TryUpdateModelAsync(
[NotNull] object model,
[NotNull] Type modelType,
string prefix)
{
if (BindingContext == null)
{
@ -1335,7 +1339,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
modelType,
prefix,
@ -1361,7 +1365,7 @@ namespace Microsoft.AspNet.Mvc
/// <param name="predicate">A predicate which can be used to filter properties at runtime.</param>
/// <returns>A <see cref="Task"/> that on completion returns <c>true</c> if the update is successful.</returns>
[NonAction]
public async Task<bool> TryUpdateModelAsync(
public Task<bool> TryUpdateModelAsync(
[NotNull] object model,
[NotNull] Type modelType,
string prefix,
@ -1376,7 +1380,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(message);
}
return await ModelBindingHelper.TryUpdateModelAsync(
return ModelBindingHelper.TryUpdateModelAsync(
model,
modelType,
prefix,
@ -1397,7 +1401,8 @@ namespace Microsoft.AspNet.Mvc
/// <param name="model">The model to validate.</param>
/// <returns><c>true</c> if the <see cref="ModelState"/> is valid; <c>false</c> otherwise.</returns>
[NonAction]
public virtual bool TryValidateModel([NotNull] object model)
public virtual bool TryValidateModel(
[NotNull] object model)
{
return TryValidateModel(model, prefix: null);
}
@ -1410,7 +1415,9 @@ namespace Microsoft.AspNet.Mvc
/// </param>
/// <returns><c>true</c> if the <see cref="ModelState"/> is valid;<c>false</c> otherwise.</returns>
[NonAction]
public virtual bool TryValidateModel([NotNull] object model, string prefix)
public virtual bool TryValidateModel(
[NotNull] object model,
string prefix)
{
if (BindingContext == null)
{

View File

@ -16,9 +16,9 @@ namespace Microsoft.AspNet.Mvc
_antiforgery = antiforgery;
}
public async Task OnAuthorizationAsync([NotNull] AuthorizationContext context)
public Task OnAuthorizationAsync([NotNull] AuthorizationContext context)
{
await _antiforgery.ValidateRequestAsync(context.HttpContext);
return _antiforgery.ValidateRequestAsync(context.HttpContext);
}
}
}

View File

@ -69,9 +69,9 @@ namespace Microsoft.AspNet.Mvc
/// </summary>
/// <param name="context">The <see cref="ViewComponentContext"/>.</param>
/// <returns>A completed <see cref="Task"/>.</returns>
public async Task ExecuteAsync([NotNull] ViewComponentContext context)
public Task ExecuteAsync([NotNull] ViewComponentContext context)
{
await context.Writer.WriteAsync(EncodedContent.ToString());
return context.Writer.WriteAsync(EncodedContent.ToString());
}
}
}

View File

@ -88,16 +88,16 @@ namespace Microsoft.AspNet.Mvc.ViewComponents
}
}
public async Task RenderInvokeAsync([NotNull] string name, params object[] arguments)
public Task RenderInvokeAsync([NotNull] string name, params object[] arguments)
{
var descriptor = SelectComponent(name);
await InvokeCoreAsync(_viewContext.Writer, descriptor, arguments);
return InvokeCoreAsync(_viewContext.Writer, descriptor, arguments);
}
public async Task RenderInvokeAsync([NotNull] Type componentType, params object[] arguments)
public Task RenderInvokeAsync([NotNull] Type componentType, params object[] arguments)
{
var descriptor = SelectComponent(componentType);
await InvokeCoreAsync(_viewContext.Writer, descriptor, arguments);
return InvokeCoreAsync(_viewContext.Writer, descriptor, arguments);
}
private ViewComponentDescriptor SelectComponent(string name)
@ -126,7 +126,7 @@ namespace Microsoft.AspNet.Mvc.ViewComponents
componentType.FullName));
}
private async Task InvokeCoreAsync(
private Task InvokeCoreAsync(
[NotNull] TextWriter writer,
[NotNull] ViewComponentDescriptor descriptor,
object[] arguments)
@ -140,7 +140,7 @@ namespace Microsoft.AspNet.Mvc.ViewComponents
Resources.FormatViewComponent_IViewComponentFactory_ReturnedNull(descriptor.Type.FullName));
}
await invoker.InvokeAsync(context);
return invoker.InvokeAsync(context);
}
private void InvokeCore(

View File

@ -21,16 +21,16 @@ namespace Microsoft.AspNet.Mvc
helper.RenderInvoke(typeof(TComponent), args);
}
public static async Task<HtmlString> InvokeAsync<TComponent>([NotNull] this IViewComponentHelper helper,
public static Task<HtmlString> InvokeAsync<TComponent>([NotNull] this IViewComponentHelper helper,
params object[] args)
{
return await helper.InvokeAsync(typeof(TComponent), args);
return helper.InvokeAsync(typeof(TComponent), args);
}
public static async Task RenderInvokeAsync<TComponent>([NotNull] this IViewComponentHelper helper,
public static Task RenderInvokeAsync<TComponent>([NotNull] this IViewComponentHelper helper,
params object[] args)
{
await helper.RenderInvokeAsync(typeof(TComponent), args);
return helper.RenderInvokeAsync(typeof(TComponent), args);
}
}
}

View File

@ -28,10 +28,10 @@ namespace System.Web.Http
public string Message { get; private set; }
/// <inheritdoc />
public override async Task ExecuteResultAsync(ActionContext context)
public override Task ExecuteResultAsync(ActionContext context)
{
context.HttpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
await base.ExecuteResultAsync(context);
return base.ExecuteResultAsync(context);
}
}
}

View File

@ -38,10 +38,10 @@ namespace System.Web.Http
public bool IncludeErrorDetail { get; private set; }
/// <inheritdoc />
public override async Task ExecuteResultAsync(ActionContext context)
public override Task ExecuteResultAsync(ActionContext context)
{
context.HttpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
await base.ExecuteResultAsync(context);
return base.ExecuteResultAsync(context);
}
}
}