Commit Graph

2 Commits

Author SHA1 Message Date
Ryan Nowak f77493dffe Part 1 of #1712 - Remove reflection in MutableObjectModelBinder
This change introduces a new property to ModelMetadata called
IsBindingRequired, which specifies whether or not a model value must be
present on the wire during model binding.

[DataMember(IsRequired = true)] is currently the only thing that will set
this property.

Updated tests and documentation for clarity on the difference in meaning
between MM.IsRequired and MM.IsBindingRequired. Moved setting for
IsRequired to ValidationMetadata which is a better fit.

Also added functional tests for [BindingBehavior] and [DataMember] in
model binding because they were totally missing.
2015-04-16 12:07:33 -07:00
Ryan Nowak 784021cf85 Fix ModelMetadata.IsRequired
The DataAnnotationsMetadataProvider was setting the bool? IsRequired, all of the
time instead of only setting it to true when we found a RequiredAttribute.
So we never actually executed the fallback logic here. Found
this while working on removing some reflection code from the validator,
and wanted to split it out because it's simple.
2015-03-23 15:32:43 -07:00