Commit Graph

4085 Commits

Author SHA1 Message Date
Doug Bunting fc3a815e57
Restore `ModelMetadata.PropertyName != null` behaviour
- #7413 part 2 of 2
- add `ModelMetadata.Name` and `ParameterName`
  - use `Name` instead of `PropertyName` in most cases
- update `ModelMetadata.ContainerType` and other property use
  - choose using `MetadataKind` almost everywhere; support all possibilties
    - usually parameter metadata was possible but not handled
    - worst case was one or two potential NREs, especially `ContainerType.*` dereferences
  - improve `MvcCoreLoggerExtensions` metadata handling
    - add three new debug messages, one for type metadata and two for parameter metadata
- update `ModelMetadata.ContainerMetadata`, `ContainerType` and `PropertyName` doc comments
- no changes needed in Microsoft.AspNetCore.Mvc.ViewFeatures because parameters aren't viewed

nits:
- add missing `TestModelMetadataProvider.ForParameter(...)` method
- remove unused `EmptyModelMetadataProvider` instances in `ModelMetadataTest`
- refactor `ModelValidationResultComparer` out of DataAnnotationsModelValidatorTest`
- take VS suggestions, mostly related to variable inlining and object initializers
2018-03-29 07:22:00 -07:00
Pranav K dae280b06a
Update dependencies.props 2018-03-28 11:29:27 -07:00
Pranav K f55730676b
Merge branch 'release/2.1' into dev 2018-03-28 11:29:05 -07:00
Pranav K 8960f605fc
Merge commit 'de3f77c34b33d5ce7f4e2a8dac12234b01cd4419' into dev 2018-03-28 11:29:00 -07:00
Pranav K f8e315d03d
CompiledPageRouteModelProvider should de-dup descriptors
Fixes #7543
2018-03-28 11:24:49 -07:00
Nate McMaster (automated) de3f77c34b
Update dependencies.props
[auto-updated: dependencies]
2018-03-28 10:56:00 -07:00
Ryan Nowak 599d1a502e Merge branch 'release/2.1' into dev 2018-03-27 17:14:24 -07:00
Ryan Nowak c93c168df3 Add mapping service for action results
This allows the use of custom 'envelope' types like ActionResult<> with
a corresponding API Explorer implementation.

Basically this PR services to decouple a bunch of infrastructure from
ActionResult<>.
2018-03-27 17:13:41 -07:00
Pranav K a72b56f49e
Merge branch 'release/2.1' into dev 2018-03-27 12:29:36 -07:00
Pranav K 927af3125e
Use RazorCompiledItemMetadataAttribute to calculate route 2018-03-27 12:24:37 -07:00
Pranav K 711a0d7003
Merge remote-tracking branch 'origin/release/2.1' into dev 2018-03-27 12:15:34 -07:00
Pranav K 62fec52a9f Add a framework specific reference to Microsoft.DiaSymReader.Native
Fixes https://github.com/aspnet/Mvc/issues/7478
2018-03-27 12:08:46 -07:00
Kiran Challa 203ebb64ed Updated dependencies.props 2018-03-27 10:07:35 -07:00
Kiran Challa 1186fa66ab Merge branch 'release/2.1' into dev 2018-03-27 10:06:51 -07:00
Kiran Challa 0c084fa28a [Fixes #7518] NullReferenceException thrown when Controller method uses Guid parameter default value 2018-03-27 05:22:20 -07:00
Doug Bunting 79c4986685
Merge branch 'release/2.1' into dev 2018-03-26 12:36:45 -07:00
Doug Bunting 5e245da326
Add compatibility switch controlling parameter metadata and top-level validation
- #7413 part 1 of 2
- made all `ModelMetadataProvider` and `ObjectModelValidator`-specific code conditional
  - fortunately, `MvcOptions` easy to get; affected code is primarily `internal` or pub-`Internal`
  - remove unnecessary `ModelMetadataProvider` use in `ApiBehaviorApplicationModelProvider`
- run integration and functional tests with `CompatibilityVersion.Version_2_1`
  - functional test change depends on @javiercn's recent #7541 fix
  - remove test code now redundantly turning compatibility switches on

nits:
- correct spelling errors in `CompatibilitySwitch`
- take VS suggestions, mostly in test code
- rename methods in `ControllerBinderDelegateProviderTest` to match current API
- slightly refactor in `ApiBehaviorApplicationModelProvider`
2018-03-26 12:29:04 -07:00
ASP.NET CI fa629cd5e1 Update dependencies.props
[auto-updated: dependencies]
2018-03-25 15:48:27 -07:00
Javier Calvarro Nelson 94d60de310 Merge remote-tracking branch 'origin/release/2.1' into dev 2018-03-24 18:35:22 -07:00
Javier Calvarro Nelson 51784bb2d6
[Fixes #7541] Per-test class customization should not remove global (per-fixture) customization 2018-03-24 18:33:48 -07:00
N. Taylor Mullen 739c8bb1dd Merge remote-tracking branch 'origin/release/2.1' into dev 2018-03-23 16:23:08 -07:00
N. Taylor Mullen e94d77c47f Add model attribute for PartialTagHelper.
- The model attribute is used to define any object based model to be passed to a `TagHelper`. It enables scenarios when users want to pass in `new` poco types.
- Added unit tests for the new `ResolveModel` method in `PartialTagHelper`.
- Added a single functional test to verify the end-to-end.

#7374
2018-03-23 16:13:55 -07:00
Ryan Nowak db6aed7f36 Merge branch 'release/2.1' into dev 2018-03-23 14:50:36 -07:00
Ryan Nowak 1ff5bdca79 Set model prefix for [ApiController]
Infers the 'empty' model prefix for complex types that are read from the value
providers. This gives us better defaults when using the parameter object
pattern with respect to swagger/API explorer.
2018-03-23 14:49:54 -07:00
Ryan Nowak 994b08844c Merge branch 'release/2.1' into dev 2018-03-23 14:24:54 -07:00
Ryan Nowak 14429721d9 Make handler selector more flexible
Some details of this pending discussion, but this is a new 2.1 change
and compatibility switch in the spirit of making pages handler selection
less error-prone.

In particular we don't want anyone to have to define HEAD to do the
trivial thing. This currently routes all 'safe' HTTP methods to the GET
handler and all other HTTP methods to the POST handler.

This is technically not the correct thing to do for OPTIONS and TRACE,
so we might still do something different.

The tests will change a little depending on exactly what we decide to
do, but this is the main idea of the change.
2018-03-23 14:22:48 -07:00
Pranav K bb408e9f18
Merge pull request #7534 from aspnet/release/2.1
Release/2.1
2018-03-23 09:38:37 -07:00
Pranav K 1d6c09ab31 Make the use of Assembly.CodeBase more robust 2018-03-23 09:35:55 -07:00
Pranav K 56501cb8a0 Cleanup ApplicationPartFactory 2018-03-23 09:35:55 -07:00
Ryan Brandenburg 8590bb9367 Updating baselines 2018-03-22 14:39:58 -07:00
Pranav K 12f8e10e1a
Merge branch 'release/2.1' into dev 2018-03-22 14:22:46 -07:00
Pranav K ccb6793126
Introduce LifecycleProperty
Update TempDataAttribute infrastructure to use LifecycleProperty
2018-03-22 10:18:36 -07:00
Pranav K 3141179344
Merge remote-tracking branch 'origin/release/2.1' into dev 2018-03-21 15:41:42 -07:00
Pranav K d6176ac7de ApplicationPartFactory: The works 2018-03-21 15:40:15 -07:00
Doug Bunting 1aeaf69f87
Merge branch 'release/2.1' into dev 2018-03-19 13:08:36 -07:00
Doug Bunting 390ebbb258
Do not bind `"[index]"` in `CollectionModelBinder` subsetting feature
- #7091
- add `IKeyRewriterValueProvider` to remove rewritten keys or value providers containing such keys
  - similar to `IBindingSourceValueProvider` except `CompositeValueProvider` keeps non-implementers around
- remove `after.Order == before.Order` special cases
  - a premature optimization that could lead to lost inner provider replacements
  - rework `EnumerableValueProviderTest` to ease test override in `CompositeValueProviderTest`
- add `EmptyValueProvider` fields to reduce `CompositeValueProvider` allocations

nits:
- remove Linq use in `CompositeValueProvider`
- do not create an unnecessary dictionary in `CompositeValueProvider.Filter(...)` methods
- accept VS suggestions, mostly pattern matching
2018-03-19 12:53:05 -07:00
Jass Bagga ed18a8f975
Seal ActionResultOfT (#7507) 2018-03-19 12:52:31 -07:00
Javier Calvarro Nelson 2bc4c40485 Merge remote-tracking branch 'origin/release/2.1' into origin-dev 2018-03-19 12:22:31 -07:00
Javier Calvarro Nelson 908e7a863b Improvements to the MVC testing package
* Clean up unnecessary workarounds on the build project.
* Remove the need to specify the content root relative to the solution
  and use a solution based on an assembly level attribute on the test
  assembly created at build time.
* Remove non parameterless constructors.
* Add support for creating specialized factories from the base factory
  and keep track of "child" factories for disposal.
* Add support for creating clients that handle cookies and redirects
  automatically.
2018-03-19 12:19:45 -07:00
Doug Bunting ef7b9022e8
Merge branch 'release/2.1' into dev 2018-03-19 12:15:02 -07:00
Doug Bunting 869825b16c
Quick fix: Add test of #2890
- tests added (ages ago) in aspnet/Mvc@a045324 no longer fail when `__` handling removed
2018-03-19 11:59:52 -07:00
Kiran Challa 236cab7cc8 Merge branch 'release/2.1' into dev 2018-03-19 11:53:22 -07:00
Kiran Challa e2b6975bff Marked PageArgumentBinder type as Obsolete 2018-03-19 11:50:20 -07:00
Kiran Challa 09b5ff7b72 Use ParameterInfo for getting metadata of a parameter to show the correct information in ApiExplorer
[Fixes #7435] 2.1-Preview 1: IsBindingRequired and IsRequired still false with RequiredAttribute on controller parameter.
2018-03-19 11:50:19 -07:00
Pranav K 3d251549c8
Merge pull request #7502 from aspnet/release/2.1
Stop building\testing on netcoreapp2.0
2018-03-19 11:01:07 -07:00
Pranav K e7b2e3fe2d Stop building\testing on netcoreapp2.0 2018-03-19 10:09:51 -07:00
Ryan Nowak bbcee05142 Merge branch 'release/2.1' into dev 2018-03-19 08:21:16 -07:00
hede f85be6a0c0 fix typo in ApiController XMLDoc 2018-03-19 08:09:10 -07:00
Ryan Nowak 75df1664e7 Merge branch 'release/2.1' into dev 2018-03-19 08:06:45 -07:00
Ryan Nowak 4875856974 Fix #4604 for good 2018-03-19 08:04:27 -07:00