Adds a new property, FieldName, to ModelBindingContext. The FieldName is
the name of whatever code-element is being bound, regardless of what
model-prefix is in use.
This is needed for cases like the Header model binder. We always want to
use the property/parameter name and we don't care about model prefixes.
We allocate a separate list for model-binding related objects when we
create the resource filter contexts, and these lists then live the
lifetime of the request. These *may* be modified by user code in
filters as a supported feature, but rarely are changed in practice.
This change adds a simple CopyOnWriteList implementation to reduce the
amount of copying that's actually done.
- Mono just pushed a change to their alpha feed that looks to have broken several MVC tests. As an interim fix specifying the version will ensure MVC builds on travis.
- The corresponding Razor change results in `HelperResult`s being rendered with async lambdas.
- This change enables `TagHelper`s and other async code to exist inside of `HelperResult` blocks.
- Added test to validate Templates (they generate `HelperResult`s) can utilize `TagHelper`s correctly.
- Rename `RazorPage`s `RenderBodyDelegate` to `RenderBodyDelegateAsync`.
aspnet/Razor#494
- #2993
- use `ClosedGenericMatcher` to handle e.g. non-generic model types implementing requested interfaces
- reduce `IsAssignableFrom()` use since created binders use explicit casts i.e. handle explicit implementations
- also add more integration tests covering various collection key formats, some with validation errors
- merge a few `[Fact]`s into `[Theory]`s
The copy constructor is chaining to the wrong constructor. This results in
an extra 8 allocations of ModelStateDictionary per-request. All of the
various filter contexts inherit from ActionContext, that's how you get the
8 extras.
Small problem but easy fix.
- #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()`
- #2905
- override `Order` implementation inherited from `TagHelper`
- only exception is `UrlResolutionTagHelper` which already overrides `Order` to execute much earlier
- #2941
- honor `ModelBindingResult.IsModelSet` and use `ModelBindingResult.ValidationNode`
- enable correct validation of collections or after model binding falls back to the empty prefix
- code previously matched `Controller.TryValidateModel()`; less context available in that case
- `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` now default to using `output.Attributes["href|src"]` if it's present when they run. This enables other `TagHelper`s to run prior and add those attributes.
- Added unit tests to validate this behavior.
- Updated `ImageTagHelper` functional test resources. Now that we're always defaulting to `output.Attributes["src"]` for `ImageTagHelper.Src` we're properly copying attributes back into the `output.Attributes` collection in the correct order (isntead of appending to the end).
#2902
- Updated implementation to do a best guess at copying an attribute back into `TagHelperOutput.Attributes`.
- Updated existing functional and unit tests to account for maintained attribute order.
- Added a set of complex order based unit tests to validate `CopyHtmlAttribute` properly maintains order.
#2639