This change removes reflection from validator providers, and instead relies on cached metadata in in the modelmetadata. In general this means that our MVPs don't need to cache anything, they just look at the metadata and create what they need. In the case of data-annotations, we update the model details provider to add validation attributes to the modelmetadata. This would allow someone to replace the DataAnnotationsValidatorProvider, but still use the metadata in these attributes. The change to the IModelValidatorProvider api (to use a context) is intended to minimize allocations. Currently each validator provider needs to return a list so you end up with N+1 lists (N validators + a final list to compine them all). This change will let us just create the final list (and a small context object). This is a very very high traffic API so it seemed worth doing. There's also some general massaging of namespaces and file locations. |
||
|---|---|---|
| .. | ||
| Controllers | ||
| Models | ||
| Services | ||
| ViewModels | ||
| Views/Vehicle | ||
| wwwroot | ||
| AdditionalValuesMetadataProvider.cs | ||
| CaculatorContext.cs | ||
| DefaultCalculator.cs | ||
| DefaultCalculatorContext.cs | ||
| FromNonExistantBinderAttribute.cs | ||
| FromTestAttribute.cs | ||
| ICalculator.cs | ||
| ITestService.cs | ||
| ModelBindingWebSite.xproj | ||
| ModelMetadataExtensions.cs | ||
| Result.cs | ||
| Startup.cs | ||
| TestBindingSourceModelBinder.cs | ||
| TestService.cs | ||
| project.json | ||
| readme.md | ||
readme.md
ModelBindingWebSite
This web site illustrates how to use and configure various knobs of model binding to let the model binding system bind action parameters to the values which are present in the request. The website also uses model validation to validate the models created using model binding.