Commit Graph

63 Commits

Author SHA1 Message Date
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
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
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
jacalvar 6a6d2e0d9f [Fixes #4506] Move and rename ActionDescriptor.Name to ControllerActionDescriptor.ActionName 2016-05-31 23:13:20 -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
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 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
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
Kiran Challa a259638d79 Filters provided by filter providers are made to never be cached
[Fixes #4504] Possible double-execution of filter providers
2016-04-22 16:56:08 -07:00
Ryan Nowak 87704c67e1 React to routing cleanup 2016-04-21 07:55:20 -07:00
Pavel Krymets 42c3397b6e Migrate tests, tools and samples to portable 2016-04-18 17:20:15 -07:00
Ryan Nowak 3ec60a0181 Fix #4447 - Teach MVC to understand defaults
The wireup for defaults in attribute routes was missing
2016-04-11 14:38:29 -07:00
Pranav K c66c408c15 DefaultAssemblyPartDiscoveryProvider.IsCandidateLibrary should not look at types in Mvc assemblies
Fixes #4363
2016-04-06 08:41:12 -07:00
Kiran Challa cda1307848 Updated test to fix build break 2016-04-03 08:01:15 -07:00
Kiran Challa 4cd3012886 Fix mixed route for action error message 2016-04-03 06:55:11 -07:00
jacalvar f638c051fa Remove IAssemblyProvider and update DNX to work with application parts.
* Remove IAssemblyProvider.
* Remove DefaultAssemblyProvider in favor of DefaultAssemblyPartDiscoveryProvider.
* Update AddMvcDnx to add the list of DNX discovered assemblies to the list of application parts.
2016-04-01 11:01:09 -07:00
jacalvar 0d0aad41f5 [Fixes #4014] Add overload to AddControllerAsServices that uses the default controller discovery logic.
* Added ControllerFeature and ControllerFeatureProvider to perform controller discovery.
* Changed controller discovery to use application parts.
* Changed ControllerActionDescriptorProvider to make use of Application parts.
* Simplified AddControllerAsServices to not accept any parameter and perform
  controller discovery through the ApplicationPartManager in the IMvcBuilder
  and IMvcCoreBuilder. Assemblies should be added to the ApplicationPartManager
  in order to discover controllers in them.
2016-04-01 09:29:37 -07:00
Doug Bunting 6bf25cecec React to HttpAbstractions namespace changes
- aspnet/HttpAbstractions#549 and aspnet/HttpAbstractions#592
- clean up `using`s
2016-03-30 16:19:42 -07:00
Ryan Nowak fb81a5e11e Introducing ModelBinderFactory
This change separates model binding into IModelBinderProvider (decides
which binder to use) and IModelBinder (does binding). The
IModelBinderFactory is a new services with coordinates the creation of
model binders.
2016-03-29 15:45:14 -07:00
Pranav K 529fa67c2b Adding tests for PrefixContainer
Fixes #4045
2016-03-28 14:31:17 -07:00
Doug Bunting 43836aec18 An `ObjectPoolProvider` is always registered
- react to aspnet/Hosting/pull#673
2016-03-25 11:20:15 -07:00
Ajay Bhargav Baaskaran 8e6b4980e3 [Fixes #4310] Moved AuthorizeFilter and CorsAuthorizationFilter to a public namespace 2016-03-21 11:54:03 -07:00
mnltejaswini fd984563c3 [Perf] Optimize CoerceResultToTaskAsync to remove MethodInfo.Invoke 2016-03-17 16:12:55 -07:00
Pranav K f651f18d3a Use a prefix tree as a backing store for ModelStateDictionary 2016-03-17 10:09:36 -07:00
jacalvar cef81adb21 [Fixes #4237] Include Assembly-Qualified type name in ActionDescriptor.DisplayName 2016-03-16 15:26:25 -07:00
mnltejaswini 007c47d065 [Perf] Optimize controller action invoke
Fixes aspnet/MVC#3903
2016-03-14 10:17:55 -07:00
N. Taylor Mullen 33d1aea8ea Transition to Netstandard.
- dotnet5.X => netstandard1.y (where y = x-1).
- DNXCore50 => netstandardapp1.5.
- Applied the same changes to ifdefs.
2016-03-01 13:39:31 -08:00
Kiran Challa b7cde3e58f [Fixes #4043] Figure out ControllerModel.AttributeRoutes 2016-03-01 10:28:24 -08:00
Kiran Challa 779edb6fe1 React to Routing service collection extension changes 2016-02-22 11:43:08 -08:00
Kiran Challa fd3ee49987 [Fixes #4085] Controller helper inconsistency: HttpNotFound(), Ok() 2016-02-19 09:25:04 -08:00