[Fixes #3426] Removed defensive copy in CompositeModelBinder and CompositeModelValidatorProvider

This commit is contained in:
Ajay Bhargav Baaskaran 2015-11-05 17:13:50 -08:00
parent decf882341
commit 1927730f40
3 changed files with 7 additions and 7 deletions

View File

@ -23,18 +23,18 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
/// Initializes a new instance of the CompositeModelBinder class.
/// </summary>
/// <param name="modelBinders">A collection of <see cref="IModelBinder"/> instances.</param>
public CompositeModelBinder(IEnumerable<IModelBinder> modelBinders)
public CompositeModelBinder(IList<IModelBinder> modelBinders)
{
if (modelBinders == null)
{
throw new ArgumentNullException(nameof(modelBinders));
}
ModelBinders = new List<IModelBinder>(modelBinders);
ModelBinders = modelBinders;
}
/// <inheritdoc />
public IReadOnlyList<IModelBinder> ModelBinders { get; }
public IList<IModelBinder> ModelBinders { get; }
public virtual Task<ModelBindingResult> BindModelAsync(ModelBindingContext bindingContext)
{

View File

@ -17,20 +17,20 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
/// <param name="providers">
/// A collection of <see cref="IModelValidatorProvider"/> instances.
/// </param>
public CompositeModelValidatorProvider(IEnumerable<IModelValidatorProvider> providers)
public CompositeModelValidatorProvider(IList<IModelValidatorProvider> providers)
{
if (providers == null)
{
throw new ArgumentNullException(nameof(providers));
}
ValidatorProviders = new List<IModelValidatorProvider>(providers);
ValidatorProviders = providers;
}
/// <summary>
/// Gets the list of <see cref="IModelValidatorProvider"/> instances.
/// </summary>
public IReadOnlyList<IModelValidatorProvider> ValidatorProviders { get; }
public IList<IModelValidatorProvider> ValidatorProviders { get; }
/// <inheritdoc />
public void GetValidators(ModelValidatorProviderContext context)

View File

@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
return new TestModelValidatorProvider(providers);
}
public TestModelValidatorProvider(IEnumerable<IModelValidatorProvider> providers)
public TestModelValidatorProvider(IList<IModelValidatorProvider> providers)
: base(providers)
{
}