- Removes IExcludeTypeFilter
- Replaced with a property 'ValidateChildren' on ModelMetadata
- Teach ValidationVisitor to respect 'ValidateChildren' for enumerable
types.
The accessor for ElementMetadata can sometimes return null when
concurrently accessed.
This change solves this issue and simplified a bunch of lazy-computed
properties, by precomputing all type-related facets of ModelMetadata.
This also adds a ElementType property to ModelMetadata to maintain
the current separation of concerns as ModelMetadata is unaware of the
metadata provider.
- #3227
- much of change is to tests, creating and passing `ModelMetadata`
- updated `InputFormatterContext` to make `ModelMetadata` available to `JsonInputFormatter`
- walk `ModelMetadata` tree to get information about property with an issue
- add missing `null` checks in `ModelStateDictionaryExtensions`
- #2969
- add `ModelBindingMessages` for configuration and `IBindingMetadataProvider` overrides
- use `interface` to avoid `new` oddities when adding a setter to an `abstract` property
- add `IModelBindingMessages` to `ModelMetadata` for use in rest of the product code
- plumb the various bits through the system
- add integration tests using a custom `IBindingMetadataProvider`s to override messages
nits:
- remove unused resources
- use `AttemptedValue` and not `model` in `SimpleTypeModelBinder`
- #2992
- use new properties to replace common helper methods
- still a few `Nullable.GetUnderlyingType()` calls
- creating `ModelMetadata` or sites lacking `ModelMetadata` access e.g. `ModelBindingHelper.ConvertTo()`
- part II of II for #2445
- `FormCollectionModelBinder` is an exception because container is not user-provided
- no `ModelState` entry added
- enable tests that #2445 was blocking
- fix these and other tests expecting different `ModelState` entries
- simplify logic in `FormFileModelBinder`
`ValueProviderResult`
- remove `protected` setters and parameterless constructor
- no scenario for their use in subclasses; however `ConvertTo()` remains `virtual`
- add single-parameter constructor
- use in most of the greedy and type-matching model binders
- add doc comments throughout class
nits:
- use new `ValueProviderResult` constructor in many existing tests
- `""` -> `string.Empty` and `vpr` -> `valueProviderResult` in `ValueProviderResultTest`
- improve some test names in `BodyValidationIntegrationTests`
- do not check `Message` of a Json.NET `Exception`
- #2664
- use new property to correctly determine `isTargetEnum` in `GetCurrentValues()`
- avoid `ArgumentNullException` in all cases where raw values are `enum` but target is not
- stop skipping tests blocked by #2664, exposing a couple more #1487 issues
- use new property instead of private `GetElementType()` methods where possible
- cleans up some duplicate code
- also remove redundant use of `IsCollectionType` and `ElementMetadata`
nits:
- move properties above methods in `ModelMetadata`
- avoid accidentally-incorrect "Remove Unnecessary Usings"
This is the first step is some more refactorings to come in the future
with the goal of making MVC less monolythic. This makes the core of MVC
more reusable and more in line with the design of other vNext platform
components.
With this change, Mvc.Core contains just the minimal guts needed to build
a working app.
- Action Discovery
- Action Invoker
- Filters
- ObjectResult
- Model Metadata
- Model Binding
- Formatters
- Validation System
And yes, we are aware of the irony of 'minimal MVC' not including the view
system. The idea is that this is the kernel of an MVC app, and anything
real is layered on top.
The most noticable impact of this change is that MvcOptions has been blown
apart into more managable chunks. See the various ConfigureMvc*** methods.
The new Mvc.Extensions package is a placeholder while we evaluate and tune
the new definitions. Expect more changes as features are move to their own
packages, and in some case their own repositories.
For now there is no experience to bootstrap an Mvc.Core app. That's coming
next.
Also ensures that when a type is marked as skipped, any sub property which is model bound (and hence a modelstate un validated entry),
is marked as skipped (otherwise it would cause the ModelState to be invalid).
Also fixing a bug in model state dictionary FindKeyWithPrefix was not considering [0] & [0][0] as a valid prefix.
- in .kproj files, let VS mark a couple more test projects as such
- remove duplicate `ModelExpression` class
- not necessary now that test project references MVC Core project
- follow up to 9fded74
- avoid `resources` warning in project.json files
Creates a new package 'Microsoft.AspNet.Mvc.Abstractions' which defines
APIs and contracts for core concepts and extensibility points in MVC.
Includes:
- ModelBinding
- Validation
- Model State
- Model Metadata
- Action Descriptors
- IActionResult
- Filters
- IActionConstraint