[PERF] Remove extra ModelStateDictionary allocations

The copy constructor is chaining to the wrong constructor. This results in
an extra 8 allocations of ModelStateDictionary per-request. All of the
various filter contexts inherit from ActionContext, that's how you get the
8 extras.

Small problem but easy fix.
This commit is contained in:
Ryan Nowak 2015-08-24 15:20:55 -07:00
parent 054b46c1cc
commit cfd9bfe13b
1 changed files with 5 additions and 2 deletions

View File

@ -29,9 +29,12 @@ namespace Microsoft.AspNet.Mvc
/// </summary> /// </summary>
/// <param name="actionContext">The <see cref="ActionContext"/> to copy.</param> /// <param name="actionContext">The <see cref="ActionContext"/> to copy.</param>
public ActionContext([NotNull] ActionContext actionContext) public ActionContext([NotNull] ActionContext actionContext)
: this(actionContext.HttpContext, actionContext.RouteData, actionContext.ActionDescriptor) : this(
actionContext.HttpContext,
actionContext.RouteData,
actionContext.ActionDescriptor,
actionContext.ModelState)
{ {
ModelState = actionContext.ModelState;
} }
/// <summary> /// <summary>