Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkm committed Jul 16, 2020
1 parent 6721924 commit 7c48769
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Expand Up @@ -642,7 +642,7 @@ public abstract partial class ModelMetadata : Microsoft.AspNetCore.Mvc.ModelBind
public abstract System.Type BinderType { get; }
public abstract Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource BindingSource { get; }
public virtual Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata? BoundConstructor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public abstract System.Func<object[], object> ConstructorInvoker { get; }
public virtual System.Func<object[], object>? ConstructorInvoker { get { throw null; } }
public virtual Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata ContainerMetadata { get { throw null; } }
public System.Type? ContainerType { get { throw null; } }
public abstract bool ConvertEmptyStringToNull { get; }
Expand Down
Expand Up @@ -67,7 +67,7 @@ public abstract class ModelBindingMessageProvider
/// <summary>
/// Error message the model binding system adds when <see cref="ModelError.Exception"/> is of type
/// <see cref="FormatException"/> or <see cref="OverflowException"/>, value is unknown, and error is associated
/// with a collection element .
/// with a collection element.
/// </summary>
/// <value>Default <see cref="string"/> is "The supplied value is invalid.".</value>
public virtual Func<string> NonPropertyUnknownValueIsInvalidAccessor { get; } = default!;
Expand Down
2 changes: 1 addition & 1 deletion src/Mvc/Mvc.Abstractions/src/ModelBinding/ModelMetadata.cs
Expand Up @@ -498,7 +498,7 @@ internal IReadOnlyList<ModelMetadata> BoundProperties
/// <summary>
/// Gets a delegate that invokes the constructor.
/// </summary>
public abstract Func<object[], object> ConstructorInvoker { get; }
public virtual Func<object[], object>? ConstructorInvoker => null;

/// <summary>
/// Gets a display name for the model.
Expand Down
Expand Up @@ -230,7 +230,7 @@ internal static bool CreateModel(ModelBindingContext bindingContext, ModelMetada
}
}

var result = await BindParameter(bindingContext, parameter, parameterBinder, fieldName, modelName);
var result = await BindParameterAsync(bindingContext, parameter, parameterBinder, fieldName, modelName);

if (result.IsModelSet)
{
Expand Down Expand Up @@ -262,7 +262,7 @@ internal static bool CreateModel(ModelBindingContext bindingContext, ModelMetada
var fieldName = parameter.BinderModelName ?? parameter.ParameterName;
var modelName = ModelNames.CreatePropertyModelName(bindingContext.ModelName, fieldName);

var result = await BindParameter(bindingContext, parameter, parameterBinder, fieldName, modelName);
var result = await BindParameterAsync(bindingContext, parameter, parameterBinder, fieldName, modelName);

if (result.IsModelSet)
{
Expand Down Expand Up @@ -325,7 +325,7 @@ internal static bool CreateModel(ModelBindingContext bindingContext, ModelMetada
}
}

var result = await BindProperty(bindingContext, property, propertyBinder, fieldName, modelName);
var result = await BindPropertyAsync(bindingContext, property, propertyBinder, fieldName, modelName);

if (result.IsModelSet)
{
Expand Down Expand Up @@ -355,7 +355,7 @@ internal static bool CreateModel(ModelBindingContext bindingContext, ModelMetada
var fieldName = property.BinderModelName ?? property.PropertyName;
var modelName = ModelNames.CreatePropertyModelName(bindingContext.ModelName, fieldName);

await BindProperty(bindingContext, property, propertyBinder, fieldName, modelName);
await BindPropertyAsync(bindingContext, property, propertyBinder, fieldName, modelName);
}
}
}
Expand Down Expand Up @@ -390,7 +390,7 @@ internal bool CanBindItem(ModelBindingContext bindingContext, ModelMetadata prop
return true;
}

private async Task<ModelBindingResult> BindProperty(
private async ValueTask<ModelBindingResult> BindPropertyAsync(
ModelBindingContext bindingContext,
ModelMetadata property,
IModelBinder propertyBinder,
Expand Down Expand Up @@ -435,7 +435,7 @@ internal bool CanBindItem(ModelBindingContext bindingContext, ModelMetadata prop
return result;
}

private async Task<ModelBindingResult> BindParameter(
private async ValueTask<ModelBindingResult> BindParameterAsync(
ModelBindingContext bindingContext,
ModelMetadata parameter,
IModelBinder parameterBinder,
Expand Down Expand Up @@ -717,7 +717,7 @@ private void ThrowObjectCannotBeCreated(ModelMetadata metadata)
}
}

public static class Log
private static class Log
{
private static readonly Action<ILogger, string, Type, Exception> _noPublicSettableProperties = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
Expand Down

0 comments on commit 7c48769

Please sign in to comment.