This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Some Dictionaries do not get model bound #1418
Closed
Description
Consider the model
public class Foo
{
public Dictionary<string, string> Values { get; set; }
}
The name generated by Html.NameFor(v => v.Values["height"])
is Values[height]
however this expression does not get model bound.
There's a gap in the collection model binder where it only attempts to bind numeric keys. The right fix for this would be to call into IEnumerableValueProvider
and then bind each key and value independently and add the result to the dictionary.