Commit Graph

15 Commits

Author SHA1 Message Date
Ryan Nowak 8a502dbe5d Rewrite of validation 2015-09-25 16:56:42 -07:00
Ryan Nowak a318c4599a API Review - Split up .Actions
Abstractions - Core MVC extensibility

Controllers - MVC implementations of .Abstractions and supporting
contracts

Infrastructure - General purpose support APIs. Metadata APIs that don't
fit clearly with a feature or with .Abstraction
2015-09-21 21:54:02 -07:00
Ryan Nowak a6aaef0d63 Optimize async code in model binders
Optimize the 'no-op' path for our model binders to return a cached task
where possible without going async.
2015-09-08 09:42:34 -07:00
Ryan Nowak 076ce6a8a1 Make ModelBindingResult a struct. 2015-09-03 12:52:50 -07:00
Ryan Nowak 229724c4ea Reorganize MVC namespaces 2015-09-01 22:28:33 -07:00
Doug Bunting 829a5c9046 Expand model types `GenericModelBinder` can handle
- #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
2015-08-25 09:50:31 -07:00
Ryan Nowak 6d365e9a32 Make ValueProviderResult a string-ish struct 2015-08-21 11:02:40 -07:00
Mugdha Kulkarni 933a13608f Adding fix for 2756 and test cases. Skipping the test cases for 2793. 2015-07-10 15:58:36 -07:00
Doug Bunting a170a4e1e4 Add `ModelBindingContext.IsFirstChanceBinding` and `IsTopLevelObject`
- cleanup duplicate code now that #2445 is fixed
- update unit tests using old `ModelBindingContext` setups
- fix (just) one integration test where `MutableObjectModelBinder` incorrectly calculated
  `isTopLevelObject` and returned a non-`null` model
- undo temporary changes in `BodyModelBinderTests` due to increased reliance on incorrect
  `isTopLevelObject` in #2445 fix

nits:
- combine tests that are now duplicates
- beef up coverage of some `MutableObjectModelBinderTest` cases
- remove unused `using`s
2015-06-24 09:17:29 -07:00
Doug Bunting 715a0b6021 Add `ModelState` entries for greedy and type-matching model binders
- part II of II for #2445
- `FormCollectionModelBinder` is an exception because container is not user-provided
 - no `ModelState` entry added
- enable tests that #2445 was blocking
 - fix these and other tests expecting different `ModelState` entries
- simplify logic in `FormFileModelBinder`

`ValueProviderResult`
- remove `protected` setters and parameterless constructor
 - no scenario for their use in subclasses; however `ConvertTo()` remains `virtual`
- add single-parameter constructor
 - use in most of the greedy and type-matching model binders
- add doc comments throughout class

nits:
- use new `ValueProviderResult` constructor in many existing tests
- `""` -> `string.Empty` and `vpr` -> `valueProviderResult` in `ValueProviderResultTest`
- improve some test names in `BodyValidationIntegrationTests`
- do not check `Message` of a Json.NET `Exception`
2015-06-23 22:34:55 -07:00
Ryan Nowak 8f38650d1f Fix #1579 - Bind top-level collections as an empty collection
This change treats 'top-level' collection-type models similarly to
top-level POCO model - namely that they will always be instantiated even
if there's no data to put inside.
2015-05-21 22:46:04 -07:00
Harsh Gupta 88ac4b94e4 Fixing #2466, #2446.
The assumption is ModelState should have entries if
1. An error is explicitly added by a model binder.
2. There is validation error reported while validating the model.
3. There is value bound by the model binder.

With this change there should be no extra entry other than for the cases mentioned above.

Also enabling the integration test cases.
2015-05-15 12:27:41 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
Ryan Nowak 4b686b1234 Part 2 of integration tests for GenericModelBinder
This includes a random sampling of combinations where a collection model
binder is binding another collection as an element type.
2015-04-29 16:52:52 -07:00
Ryan Nowak f77bb0ed2f GenericModelBinder integration tests part 1
- Covers simple scenario for each model binder.
- Covers scenarios mixing a generic model binder with a greedy model
  binder.
2015-04-28 17:43:29 -07:00