- #4116
- generalize rules for `ModelMetadata` creation; minimize metadata changes when Model is updated
- down to a single special case in VDD for `Nullable<T>`
- note existing functional tests did not need to change
- remove `ViewDataDictionary(ViewDataDictionary, object)` constructor; use `new VDD<object>(source, model)`
- allow all `Model` assignments in a view component
- copy-constructed VDD in `ViewComponentContext` previously preserved the source's declared type
nits:
- do not call `virtual SetModel()` method from constructor; now mostly redundant
- logic in copy constructor and `SetModel()` is consistent but different enough to keep code separate
- add some missing doc comments
- fix doc comment property versus type confusion; never need to specify `ViewDataDictionary.` prefix
- fix a few `TemplateBuilder` comments and remove unnecessary `model: null` argument to VDD constructor
* Added ViewComponentFeture and ViewComponentFeatureProvider to perform view component discovery.
* Changed view component discovery to use application parts.
* Changed ViewComponentDescriptorProvider to make use of Application parts.
* Added AddViewComponentsAsServices method on IMvcBuilder that performs view component
discovery through the ApplicationPartManager and registers those view components as
services in the service collection. Assemblies should be added to the ApplicationPartManager
in order to discover view components in them in them.
- #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)`
* Moved instantiation of view components into DefaultViewComponentActivator
* Introduced IViewComponentFactory to handling setup of new view component instances.
* Added a release method on IViewComponentActivator for handling tear down of view
component instances.