Commit Graph

135 Commits

Author SHA1 Message Date
ivano scifoni b4677a44da #4847 Fix MapAreaRoute override existing area constraint (#4954)
*  #4847 Fix MapAreaRoute override existing area constraint
Modify Test project
Modify web test routing

* wrong field tested

* IntRouteConstraint expected

* Default for area route on Travel area

* Removed commented code
simplify constraintsDictionary area assign
renamed test method

* test name

* renamedd test to MapAreaRoute_DoesNotReplaceValuesForAreaIfAlreadyPresentInConstraintsOrDefaults
2016-07-11 10:53:33 -07:00
Doug Bunting 7430efa8cc One build to rule them all
- well, at least VS and command-line builds will share output
- part of aspnet/Coherence-Signed#277
2016-07-06 16:21:18 -07:00
Pranav K 222165e145 Updating to RTM builds of xunit and Moq (#4946) 2016-07-05 20:58:16 -07:00
Ryan Nowak 3ed0d01eae Fix #4929 - Move IActionInvokerFactory from .Internal
Also added a wealth of doc comments to an area that's not currently super
well documented.
2016-07-05 13:18:34 -07:00
Doug Bunting 42cea41737 Fail more gracefully when option collections cleared
- #4690
- move `ModelBindingMessageProvider` init from `DefaultBindingMetadataProvider` to `DefaultModelMetadata`
 - in addition to avoiding error cases, this removes some boilerplate
- add specific errors to `BodyModelBinderProvider`, `CompilerCache`, `CompositeViewEngine`, `ModelBinderFactory`,
  and `ObjectResultExecutor`
 - `DefaultRazorViewEngineFileProviderAccessor.FileProvider` now a `NullFileProvider` in empty case
2016-06-30 14:52:50 -07:00
Pranav K cd7954a164 Updating to dev versions 2016-06-16 10:40:11 -07:00
N. Taylor Mullen 8499e3d6bb Remove direct Microsoft.NETCore.Platforms dependency.
- Microsoft.NETCore.App now pulls this package in.

aspnet/Coherence-Signed#344
2016-06-13 15:30:27 -07:00
Ryan Brandenburg 5339a3e0ce Add ExceptionHandled to ExceptionContext (#4825) 2016-06-09 15:22:11 -07:00
Ryan Nowak 31ec88526a Fix #4801 Rename ValidationExcludeFilter
'ValidationExcludeFilter' -> 'SuppressChildValidationMetadataProvider'

Also moved to .ModelBinding for improved discoverability. There aren't
many reasons user code would have a using for .Validation.
2016-06-09 10:51:31 -07:00
Ryan Nowak baf0b6a5c7 Fix #4803 - Move some types internal
Moves IControllerArgumentBinder and IControllerPropertyActivator into
.Internal. Also renames ControllerArgumentBinder ->
DefaultControllerArgumentBinder for consistency with other controller
extensibility types.

We don't think these are 100% baked for our long term maintenance of the
product, and want to reserve the ability to make changes in the future.
2016-06-09 09:36:15 -07:00
Doug Bunting aecfe778ee Improve handling of custom `ValidationAttribute`s and their `ValidationResult`s
- #3595 sub-items 2 through 4
- handle an indexer name in `ValidationResult.MemberNames`
 - aligns `ModelNames.CreatePropertyModelName()` with `TemplateInfo.GetFullHtmlFieldName()`
- handle multiple elements in `ValidationResult.MemberNames`
 - later elements previously ignored
- set `ValidationContext.MemberName` to `null` when no property name is available
 - using type name for a member name was just wrong
2016-06-08 12:05:01 -07:00
Derek Gray 5a3875ea72 Alter content negotiation algorithm so that it can be configured (via
MvcOptions) to always respect an explicit Accept header. Fixes #4612.
2016-06-07 16:12:36 -05:00
Ryan Nowak 2e2784aa3d [Design] Split up MvcRouteHandler
This change splits up the conventional routing path from the attribute
routing path *inside* routing, instead of inside `MvcRouteHandler`. Each
attribute route group now gets its own instance of
`MvcAttributeRouteHandler` which just knows about the actions it can
reach.

This removes the concept of a route-group-token and removes the lookup
table entirely for attribute routing. This also means that the
`DefaultHandler` on `IRouteBuilder` will not be used for attribute routes,
which we are OK with for 1.0.0.

The action selector's functionality is now split into two methods. We
think this is OK for 1.0.0 because any customization of `IActionSelector`
up to now had to implement virtually the same policy as ours in order to
work with attribute routing. It should now be possible to customize the
selector in a meaningful way without interfering with attribute routing.
2016-06-07 08:12:47 -07:00
Ryan Nowak 78c130d226 Fix for #4666 - reduce modelbinders created
This change to ModelBinderFactory makes the caching much more aggressive,
by caching all non-root binders. There's some trickiness here around
making sure we have the right behavior when all providers return null. See
the tests and comments.

I also kept the change I made for a temporary workaround to use a
dictionary rather than a "stack" for cycle breaking.  This seems like an
overall improvement in clarity.
2016-06-06 09:01:51 -07:00
jacalvar 6a6d2e0d9f [Fixes #4506] Move and rename ActionDescriptor.Name to ControllerActionDescriptor.ActionName 2016-05-31 23:13:20 -07:00
jacalvar 8493064fe5 [Fixes #4207] Review IActionResult classes and add facades as necessary.
* Moved FileResults to use executor façades
* Changed redirect result types to use executor façades.
2016-05-31 22:46:18 -07:00
Hao Kung 13a3bbaeb6 Update AuthZ test 2016-05-31 17:16:47 -07:00
Ajay Bhargav Baaskaran 283573d6c9 [Fixes #4291] Simplified MvcRouteHandler code 2016-05-31 15:02:14 -07:00
Hao Kung c7a46e4caf AuthPolicy should use IPolicyProvider 2016-05-31 13:47:58 -07:00
Doug Bunting e63f094a5f Use type metadata for `ModelBinderProviderContext.BindingInfo`
- #4652
- previously ignored for top-level models
- `ModelBinderProviderContext.BindingInfo` is now never `null`
- similarly, use type metadata (as well as parameter info) for `ModelBindingContext.BinderModelName`
 - previously ignored when overridden in `ControllerArgumentBinder`
2016-05-27 23:00:29 -07:00
Pranav K abf9319e6c Modify test to look for assembly names rather than absolute paths
This workaround an issue \ bug with the results returned by DependencyContext where
the path uses a mix of forward and back slashes which causes comparison with Assembly.Location that only
uses forward slashes to fail.
2016-05-26 14:49:37 -07:00
Pranav K 5d72a7f747 Modify ICompilationLibrariesProvider to return a sequence of reference path
Fixes #4738
2016-05-25 16:20:23 -07:00
Ajay Bhargav Baaskaran 3d0f436a06 [Fixes #4294] TypeActivate MvcRouteHandler 2016-05-25 12:57:16 -07:00
Hao Kung f54a964815 AuthZFilter should call into Service more 2016-05-24 14:42:54 -07:00
Ryan Nowak d92b3ba2c6 Make ModelBindingContext.Result non-nullable
This change simplifies a bunch of code and fits more in line with the
current design of model binding.

Now, a model binder only has to do anything if it was successful.
'return' is enough to indicate failure.
2016-05-23 14:18:34 -07:00
Ryan Nowak 88c9ae6588 Remove Key from ModelBindingResult 2016-05-23 13:17:19 -07:00
Ryan Nowak ef29749e72 Remove usage of `async void` in unit tests
Yes I know xUnit supports it, but it's non-standard and it shouldn't show
up anywhere in our codebase.
2016-05-20 15:07:48 -07:00
jacalvar ee2a591d2c [Fixes #4655] Make comparisons in DefaultAssemblyPartDiscoveryProvider case insensitive 2016-05-20 11:22:55 -07:00
jacalvar a490cf13a6 [Fixes #4555] Assemblies with a transitive dependency to MVC are not included as part of the list of discovered assemblies 2016-05-20 11:18:34 -07:00
Kiran Challa 20a2e748ec Added ValueProviderFactories to ResourceFilterExecutingContext
This enables removing value provider factories from model binding(which is needed in some scenarios like large file uploads)
2016-05-20 04:15:07 -07:00
mnltejaswini d7ccea17ce [Perf] Refactoring ControllerActionInvoker to avoid coercing action method's return type to Task<object> for simple cases. Fixes #4539 2016-05-19 14:21:29 -07:00
mnltejaswini 74357b3ed8 [Perf] Fast Generate Url for specific cases to avoid string allocations 2016-05-18 18:08:25 -07:00
Ryan Brandenburg 941da9264b Move ModelBindingHelper to Internal (#4664) 2016-05-18 16:52:43 -07:00
Kristian Hellang 230776f4b0 Added Permanent property to configure RequireHttpsAttribute
Fixes #4561
2016-05-16 16:18:53 -07:00
mnltejaswini 61a176e478 [Perf] Cache the default values for action arguments to avoid Activator.CreateInstance per argument.
Fixes #4470
2016-05-16 11:43:34 -07:00
Ryan Nowak 1e02fd2e6b Merge invoker back into one class
This will help future generations maintain this class. Notice that the
protected methods that are going away all just call into another
extensibility point (other than the executor). If we need to we could make
that extensible in the future and then we have the same support with fewer
hooks and less complexity.
2016-05-13 17:43:59 -07:00
Ryan Nowak 128d74e2a0 Refactor Argument Binder
This change just rearranges some code in the argument binder with a mind
towards performance and clarity. We're removing a few Task<T>'s here as
well in certain cases, but not yet all of them. We additionally save a
dictionary in the case where you have bound properties.

Hopefully these changes break the code into more discrete and sensible
units without multiple levels of indirection without abstraction.
- Main 'driver' code
- BindModel
- ActivateProperty
2016-05-13 08:12:14 -07:00
Ryan Nowak 4d63ffa879 Make ValueProvider creation lazy
We want this change to avoid MVC eagerly reading the form. This is good
for general perf and also for scenarios where you want read the body
yourself (large file uploads).

We DO have scenarios where you want to configure the value providers
per-request or also to change the limits on the value providers (form) so
it's worth keeping these around on the context.
2016-05-13 08:11:21 -07:00
Kiran Challa e483478415 Merge branch 'release' into dev 2016-05-12 09:35:33 -07:00
Kiran Challa d6a9068008 [Fixes #4616] Filter caching is too aggressive 2016-05-11 16:58:45 -07:00
Ryan Nowak 7bd297c395 Remove unused field 2016-05-11 16:48:55 -07:00
Kiran Challa 3c2bdfd368 Merge branch 'release' into dev 2016-05-03 12:29:33 -07:00
Kristian Hellang f4679fe74f Changed RequireHttpsAttribute to default to 302 instead of 301 2016-05-03 12:11:18 -07:00
Pranav K 3d494fd732 Merge branch 'release' into dev 2016-05-02 14:58:54 -07:00
Pranav K 36146a6139 Fix build warnings 2016-05-02 14:52:02 -07:00
Doug Bunting d8d2e54506 Remove extra options to manipulate `JsonSerializerSettings`
- #4339: remove non-recommended JSON formatter constructors
 - affects `JsonInputFormatter`, `JsonOutputFormatter`, `JsonPatchInputFormatter`
 - `JsonOutputFormatter` cleanup also impacts `JsonHelper`
 - rename and make `SerializerSettingsProvider` class public; use it as appropriate
- #4409: make `SerializerSetings` properties get-only and `protected`
 - affects `JsonInputFormatter`, `JsonOutputFormatter`

Recommended patterns:
- change `JsonSerializerSettings` values in `MvcJsonOptions` for almost all customizations
- find `JsonOutputFormatter` in `MvcOptions.OutputFormatters` when limiting per-result formatters
- start with `JsonSerializerSettingsProvider.CreateSerializerSettings()` when customizing a per-result formatter
2016-04-27 14:48:16 -07:00
mnltejaswini 0788edbd4b [Perf] Cache the metadata for known type "object"
Fixes #4377
2016-04-25 13:03:52 -07:00
Ryan Nowak 756cd2dab8 Remove OperationBindingContext
This change trims a few concepts that aren't really needed inside
ModelBinders anymore, and removes the OperationBindingContext class.
2016-04-25 09:29:03 -07:00
Kiran Challa 4e8e30437f Merge branch 'release' into dev 2016-04-23 06:57:08 -07:00
Ryan Nowak af58c2e6b6 Streamlining action selection and route values
Removes a few concepts we don't need
Improves documentation
More things are IDictionary instead of other random types
2016-04-22 17:36:23 -07:00