(Un)optimize binding because missing resolution for queries
This commit is contained in:
parent
45bc08897f
commit
5938879b98
|
|
@ -100,17 +100,17 @@ namespace NejCommon.Models
|
||||||
? bindingContext.ModelName
|
? bindingContext.ModelName
|
||||||
: routeValue.Name;
|
: routeValue.Name;
|
||||||
|
|
||||||
|
var result = bindingContext.ValueProvider.GetValue(name);
|
||||||
// If these really are route values, don't go through the entire
|
// If these really are route values, don't go through the entire
|
||||||
// MVC ValueProvider infrastructure.
|
// MVC ValueProvider infrastructure.
|
||||||
if (!bindingContext.ActionContext.RouteData.Values.TryGetValue(name, out var rawValue) ||
|
if (result == ValueProviderResult.None)
|
||||||
rawValue is null)
|
|
||||||
{
|
{
|
||||||
bindingContext.ModelState.AddModelError(name, "Route value not found");
|
bindingContext.ModelState.AddModelError(name, "Route value not found");
|
||||||
bindingContext.Result = ModelBindingResult.Failed();
|
bindingContext.Result = ModelBindingResult.Failed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
values[i] = rawValue.ToString()!;
|
values[i] = result.FirstValue!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all the required route values are present
|
// Check if all the required route values are present
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user