aspnetcore/src/Microsoft.AspNet.Mvc.Core/ModelBinding
Doug Bunting 48f09d0e8d Do not trounce existing property values that are not bound in `TryUpdateModel` scenarios
- #2836

Part 1: Use existing property values when recursing in `MutableObjectModelBinder`
- remove `ComplexModelDTO` because that indirection made fixing this issue more difficult and doesn't add value
  - started with an old closed PR (#2241) which did some of this work
- correct `MutableObjectModelBinderTest` tests that exercised behaviour that can't occur
  - the old `dto.Results` dictionary was never incomplete; nor could it contain `null` values

Part 2: Change `MutableObjectModelBinder` to pass complex property values into binding system
- model binding no longer trounces nodes in the model tree that aren't bound
- create model instances less often in `TryUpdateModel` scenarios
  - refactor `EnsureModel()` to `GetModel()` and use appropriately
- reorder logic in `SetProperty()` and `AddToProperty()` to avoid copying to / from the same collection
  - also cleans up some code duplication

nits:
- clean up `MutableObjectModelBinderTest`
  - fix odd line wrappings and indentation
  - use `nameof()` more
  - use `string.Empty` more
  - simplify a couple of `Returns()` expressions
- make assertions in `TryUpdateModelIntegrationTest` more readable
  - no need to work through `ModelStateDictionary.Keys`
  - also use `Length` instead of `Count()`; test code but we don't need Linq at all in that test class
2015-08-18 09:57:41 -07:00
..
Metadata Part 3 of #2776 - revert a6ce9abab1 and add 2015-08-16 16:20:44 -07:00
Validation
ArrayModelBinder.cs Handle broader range of collection types in model binding 2015-08-11 08:26:49 -07:00
BindNeverAttribute.cs
BindRequiredAttribute.cs
BinderTypeBasedModelBinder.cs
BindingBehavior.cs
BindingBehaviorAttribute.cs
BindingSourceModelBinder.cs
BindingSourceValueProvider.cs
BodyModelBinder.cs
ByteArrayModelBinder.cs
CancellationTokenModelBinder.cs Add `ModelValidationNode`s consistently 2015-08-11 08:30:29 -07:00
CollectionModelBinder.cs Fix build break: Missing a recently-added parameter 2015-08-11 09:03:51 -07:00
CompositeModelBinder.cs
CompositeValueProvider.cs
DictionaryBasedValueProvider.cs
DictionaryModelBinder.cs Handle broader range of collection types in model binding 2015-08-11 08:26:49 -07:00
ElementalValueProvider.cs
EmptyModelMetadataProvider.cs
FormCollectionModelBinder.cs Add `ModelValidationNode`s consistently 2015-08-11 08:30:29 -07:00
FormFileModelBinder.cs Add `ModelValidationNode`s consistently 2015-08-11 08:30:29 -07:00
FormValueProviderFactory.cs
GenericModelBinder.cs Handle broader range of collection types in model binding 2015-08-11 08:26:49 -07:00
HeaderModelBinder.cs
IBindingSourceValueProvider.cs
ICollectionModelBinder.cs Handle broader range of collection types in model binding 2015-08-11 08:26:49 -07:00
ICompositeModelBinder.cs
ICompositeValueProviderFactory.cs
IEnumerableValueProvider.cs
JQueryFormValueProvider.cs
JQueryFormValueProviderFactory.cs
KeyValuePairModelBinder.cs
ModelExplorerExtensions.cs
ModelMetadataProviderExtensions.cs
ModelNames.cs
MutableObjectModelBinder.cs Do not trounce existing property values that are not bound in `TryUpdateModel` scenarios 2015-08-18 09:57:41 -07:00
MutableObjectModelBinderContext.cs
PrefixContainer.cs
QueryStringValueProviderFactory.cs
ReadableStringCollectionValueProvider.cs
RouteValueValueProviderFactory.cs
ServicesModelBinder.cs
TypeConverterModelBinder.cs Add `ModelValidationNode`s consistently 2015-08-11 08:30:29 -07:00
TypeMatchModelBinder.cs