From 38bd61777823714df43e70236ab3c13926cff6c3 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Tue, 28 Apr 2015 14:15:33 -0700 Subject: [PATCH] CR feedback from 9fded74b15065ab936c6c7b5a80157dba02f7a99 --- .../ComplexModelDtoModelBinder.cs | 1 - .../DictionaryBasedValueProvider.cs | 1 - .../ModelBinding/ElementalValueProvider.cs | 1 - .../ModelBinding/FormFileModelBinder.cs | 1 - .../ModelBinding/GenericModelBinder.cs | 1 - .../ModelBinding/HeaderModelBinder.cs | 1 - .../ModelBinding/PrefixContainer.cs | 20 +++++++++---------- .../ReadableStringCollectionValueProvider.cs | 1 - .../ModelBinding/TypeConverterModelBinder.cs | 1 - .../ModelBinding/TypeMatchModelBinder.cs | 1 - .../Validation/DefaultObjectValidator.cs | 1 - 11 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs index 697ba53eb3..00ef73c64f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding { diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryBasedValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryBasedValueProvider.cs index f52389df3b..fec85a4025 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryBasedValueProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryBasedValueProvider.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ElementalValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ElementalValueProvider.cs index 427d89693f..f64dd4263d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ElementalValueProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ElementalValueProvider.cs @@ -4,7 +4,6 @@ using System; using System.Globalization; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding { diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormFileModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormFileModelBinder.cs index dff08c1e7f..e1a0bd204d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormFileModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormFileModelBinder.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/GenericModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/GenericModelBinder.cs index 0ce0d48002..41ab67da5b 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/GenericModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/GenericModelBinder.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding { diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs index f6461997b8..1044bb6c59 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs index 0e8dbf359f..0d193d271f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using Microsoft.Framework.Internal; -namespace Microsoft.AspNet.Mvc.ModelBinding.Internal +namespace Microsoft.AspNet.Mvc.ModelBinding { /// /// This is a container for prefix values. It normalizes all the values into dotted-form and then stores @@ -18,14 +18,14 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal private readonly ICollection _originalValues; private readonly string[] _sortedValues; - internal PrefixContainer([NotNull] ICollection values) + public PrefixContainer([NotNull] ICollection values) { _originalValues = values; _sortedValues = ToArrayWithoutNulls(_originalValues); Array.Sort(_sortedValues, StringComparer.OrdinalIgnoreCase); } - internal bool ContainsPrefix([NotNull] string prefix) + public bool ContainsPrefix([NotNull] string prefix) { if (prefix.Length == 0) { @@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal // - "bar"/"foo.bar" // - "hello"/"foo.hello" // - "abc"/"foo[abc]" - internal IDictionary GetKeysFromPrefix(string prefix) + public IDictionary GetKeysFromPrefix(string prefix) { var result = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -149,7 +149,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal } } - internal static bool IsPrefixMatch(string prefix, string testString) + public static bool IsPrefixMatch(string prefix, string testString) { if (testString == null) { @@ -192,13 +192,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal /// Convert an ICollection to an array, removing null values. Fast path for case where /// there are no null values. /// - private static T[] ToArrayWithoutNulls(ICollection collection) where T : class + private static TElement[] ToArrayWithoutNulls(ICollection collection) where TElement : class { Debug.Assert(collection != null); - var result = new T[collection.Count]; + var result = new TElement[collection.Count]; var count = 0; - foreach (T value in collection) + foreach (TElement value in collection) { if (value != null) { @@ -212,13 +212,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal } else { - var trimmedResult = new T[count]; + var trimmedResult = new TElement[count]; Array.Copy(result, trimmedResult, count); return trimmedResult; } } - private sealed class PrefixComparer : IComparer + private sealed class PrefixComparer : IComparer { private readonly string _prefix; diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs index 444dba64b3..346617eea9 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeConverterModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeConverterModelBinder.cs index b7760e60b5..8aa5283ecb 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeConverterModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeConverterModelBinder.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding { diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeMatchModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeMatchModelBinder.cs index 00337dc82a..16c8b35c5a 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeMatchModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeMatchModelBinder.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding { diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs index 6293c75c78..0c04131c28 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding.Validation