This change modifies the default parameter binding behavior for an
ApiController to use the WebAPI rules.
'simple types' default to use route data or query string
'complex types' default to use the body (formatters)
Adds ModelBindingAttribute to enabled model binding
Fix: The MvcOptions takes in a list of ExcludeFromValidationDelegate (Func<Type,bool>). This func verifies if the type is excluded in validation or not.
Fix: Using TypeConverter solves this problem.
-Issue #1123 - TypeConverterModelBinder cannot bind "byte" and "short".
Fix: Modified code to use TypeConverter which can handle these scenarios.
-Removing the GetConverterDelegate method and making the code similar to the WebApi.
- only affects an extreme corner case: user sets `metadata.EditFormatString` then reads
`metadata.DisplayFormatString`
- an extreme case because `EditFormatString` is normally set only when
`DisplayFormatString` is set and, if set, it's to the same value
- happened to see this while updating `CachedDataAnnotationsModelMetadata` for this PR
nit: an -> a in an adjacent XML comment in `CachedDataAnnotationsModelMetadata`
Substituted all instances of [MemberData("PropertyName")] for [MemberData(nameof(PropertyName))]
This change enables us to take advantage of IDE features like Navigate to source,
find all references, etc. When using Visual Studio.
- `DisplayFormatString` and `EditFormatString` now based on attributes
- `HasNonDefaultEditFormat` is new
- confirm `DataType` and `ScaffoldColumn` in `CachedDataAnnotationsMetadataAttributes`
- remove unused nested class `ModelWithReadOnlyProperty`
- remove unecessary nested classes `RangeAttribute` and `RequiredAttribute`
- use `Assert.NotEmpty()` and `Assert.Single()` where appropriate
2. Cleaning up the IInputFormatter to the final version.
3. Updating the input formatters and the context to be compliant with the IInputFormatter interface.
4. Adding Functional Tests.
- Not cleaning up TempInputFormatterProvider.
Conflicts:
src/Microsoft.AspNet.Mvc.Core/Formatters/InputFormatter.cs
src/Microsoft.AspNet.Mvc.Core/Formatters/JsonInputFormatter.cs
src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
src/Microsoft.AspNet.Mvc.Core/Formatters/XmlDataContractSerializerInputFormatter.cs
src/Microsoft.AspNet.Mvc.Core/Formatters/XmlSerializerInputFormatter.cs
src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs
src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.kproj
test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
Conflicts:
src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/Microsoft.AspNet.Mvc.HeaderValueAbstractions.kproj
src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.kproj
src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/FormValueProviderFactory.cs
test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
test/Microsoft.AspNet.Mvc.ModelBinding.Test/Microsoft.AspNet.Mvc.ModelBinding.Test.kproj
Conflicts:
src/Microsoft.AspNet.Mvc.Core/Formatters/FormattingUtilities.cs
src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
-Checks for ModelType before processing.
-Ignores quotes in ByteArrayModelBinder.
-Unit,functional Tests.
-ModelStateError is set when Covert.FromBase64String(value) throws.
https://roslyn.codeplex.com/workitem/246 affects usage of code with the
latest build of Roslyn with Moq v4.2. The workaround involves ensuring a
closure is created. Updating affected tests to make ToString() calls on
local variables to create these closures.
Additionally change it to use TypeExtensions.GetReadableProperties to get
property list. This causes it to ignore indexers which should not be
considered.
Fixes#595