Commit Graph

62 Commits

Author SHA1 Message Date
Pranav K 5b2a4aecb6 Make Microsoft.AspNetCore.Mvc.TestCommon a regular project
* This allows specifying all it's dependencies rather than for consuming projects to do this
* Remove unused APIs
* Fix weird downgrade warnings that show up due to P2P references
2016-11-23 16:23:56 -08:00
Pranav K 1506a44cd5 Fix downgrade warnings 2016-11-10 09:22:11 -08:00
Pranav K b82969a557 Updating versions to 1.2.0-* 2016-11-09 14:18:46 -08:00
Pranav K a52d692de0 Updating to netcoreapp1.1 2016-10-13 11:21:09 -07:00
Pranav K ed1378a365 Revert "Updating to netcoreapp1.1"
This reverts commit 398a104810.
2016-10-12 16:09:12 -07:00
Pranav K 398a104810 Updating to netcoreapp1.1 2016-10-12 14:24:52 -07:00
Kiran Challa d09e921c4a Check for default constructor in ComplexTypeModelBinderProvider 2016-10-07 16:46:13 -07:00
Pranav K 6fe683c585 Add Microsoft.DotNet.InternalAbstractions to fix tests 2016-10-04 10:11:09 -07:00
Pranav K 6d235e4ef5 Update partner package versions 2016-10-03 14:27:20 -07:00
Ryan Brandenburg 43a0a5a9f1 Replace ConfigureOptions with IConfigureOptions 2016-09-08 15:19:07 -07:00
Pranav K 67dce322df Updating to Moq \ Castle.Core that does not require imports 2016-08-08 12:20:14 -07:00
Kiran Challa ac98417398 ModelBinding: Remove IsReadOnly checks and add/update tests 2016-08-04 14:20:23 -07:00
Ryan Brandenburg 27a641f4bf Only create filters for models that need them (#5044) 2016-07-27 16:36:26 -07:00
Ryan Brandenburg 310ab25347 Make tests resilient to Localization (#5011) 2016-07-14 09:28:01 -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
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 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 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 27565c4e8d Fix broken query string binding test
This test was relying on the parsing behavior of QueryString, that it
would omit the key and value when the value is empty. The expectations
weren't consistent with other tests for 'empty' values.
2016-05-24 10:17:30 -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 Brandenburg 941da9264b Move ModelBindingHelper to Internal (#4664) 2016-05-18 16:52:43 -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
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
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
Sebastien Ros 4b4d67e48e Merge branch 'release' into dev 2016-04-22 11:54:56 -07:00
Sébastien Ros 2c639f83c4 Fixing BindNever attribute and Type model binding
Fixes #4505
2016-04-22 11:52:08 -07:00
Doug Bunting d9141d6bf8 Add tests of body-bound top-level collections
- relates to #4496

Also fix test names in `BodyValidationIntegrationTests`
2016-04-20 11:57:15 -07:00
Pranav K d87d8283d0 Use latest build of dotnet-test-xunit 2016-04-19 14:54:07 -07:00
Pavel Krymets e6ffb060f7 Bring Microsoft.NETCore.Platforms dependency back 2016-04-18 17:20:15 -07:00
Pavel Krymets 42c3397b6e Migrate tests, tools and samples to portable 2016-04-18 17:20:15 -07:00
jacalvar 1bd66ffda0 [Fixes #4089] Add support for application parts
This commit introduces application parts as a concept on MVC.

An application part is an abstraction that allows you to expose some
feature or corncern in a way that is decoupled from their underlying source.
Examples of this include types in an assembly, emdeded resources, files on
disk etc.

Application parts are configured during startup by adding or removing them from
the application part manager available as part of IMvcBuilder and IMvcCoreBuilder.

The application part manager provides the ability to populate features from the
list of available application parts by using a list of application feature providers.
Application feature providers are responsible for populating a given feature given a
list of application parts.

Examples of application providers can be a ControllerFeatureProvider
that goes through the list of application parts, sees which one of those parts exposes types,
determines which of those types are controller types, and adds them to a ControllerFeature
that holds a list of all the types that will be considered controllers in the application.
2016-03-31 12:14:04 -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 e1abb47b98 Fix #4238 IFormFile model binder suppresses validation
This change no longer suppresses validation for IFormFile and
IFormFileCollection model values. This will allow the use of [Required] on an
IFormFile model, or a custom attribute for validating IFormFileCollection.

These types already have ValidateChildren = false, so we don't recurse
into them.
2016-03-30 14:09:28 -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
David Fowler 5ddb17d2fe Fixed packages 2016-03-25 12:27:49 -07:00
Doug Bunting 43836aec18 An `ObjectPoolProvider` is always registered
- react to aspnet/Hosting/pull#673
2016-03-25 11:20:15 -07:00
Pranav K 06289945d0 Reacting to CoreCLR package changes 2016-03-22 14:49:43 -07:00
Pranav K f651f18d3a Use a prefix tree as a backing store for ModelStateDictionary 2016-03-17 10:09:36 -07:00
Pranav K 4f709bdbfd Fixing CI build break 2016-03-14 00:38:17 -07:00
Doug Bunting d3c24637b1 Correct `Type.IsAssignableFrom()` polarity
- #3482
 - see new tests; many failed without fixes in the product code
 - add support for binding `IFormFileCollection` properties
 - make `FormFileModelBinder` / `HeaderModelBinder` collection handling consistent w/ `GenericModelBinder`++
  - see also dupe bug #4129 which describes some of the prior inconsistencies
  - add checks around creating collections and leaving non-top-level collections `null` (not empty)
 - move smarts down to `ModelBindingHelper.GetCompatibleCollection<T>()` (was `ConvertValuesToCollectionType<T>()`)
  - add `ModelBindingHelper.CanGetCompatibleCollection()`
  - add fallback for cases like `public IEnumerable<T> Property { get; set; } = new T[0];`
- #4193
 - allow `Exception`s while activating collections to propagate
- part of #4181
 - `CollectionModelBinder` no longer creates an instance to check if it can create an instance
 - not a complete fix since it still creates unnecessary intermediate lists

nits:
- correct a few existing test names since nothing is not the same as `ModelBindingResult.Failed()`
- remove a couple of unnecessary `return` statements
- correct stale "optimized" comments
- explicit `(string)`
2016-03-03 09:55:01 -08:00
Doug Bunting b35922e373 Remove project name from output path
- aspnet/Coherence-Signed#187
- remove `<RootNamespace>` settings but maintain other unique aspects e.g. `<DnxInvisibleContent ... />`
- in a few cases, standardize on VS version `14.0` and not something more specific
2016-03-02 14:39:12 -08: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
Pranav K 80b6996701 * Moving DNX dependencies to test only
* Updating Mvc tests to use dotnet test to run on dnxcore50
2016-02-23 18:58:42 -08:00