Рассмотрите следующий код: < /p>
Код: Выделить всё
public ActionResult AutoCompleteHandler([FromUri]PartsQuery partsQuery){ ... }
public class PartsQuery
{
public Part[] Parts {get; set; }
public string LastKey { get; set; }
public string Term { get; set; }
}
$.ajax({
url: "Controller/AutoCompleteHandler",
data: $.param({
Parts: [{ hasLabel: "label", hasType: "type", hasIndex : 1 }],
LastKey : "Last Key",
Term : "Term"
}),
dataType: "json",
success: function(jsonData) { ... }
});
< /code>
Это работает просто нормально и правильно связывается, используя связующую модель по умолчанию в веб -API MVC < /strong>. < /p>
Однако переключить это на простые MVC, а не веб -носитель, а модель по умолчанию расщепляется и не может связывать свойства на объектах в nesed arrrame: < /p> p> p> p> p> p> p> p> p> p> pro -model. /> Смотреть список < /strong> < /p>
partsQuery != null //Good
--LastKey == "Last Key" //Good
--Term == "Term" //Good
--Parts[] != null //Good
----hasLabel == null //Failed to bind
----hasType == null //Failed to bind
----hasIndex == 0 //Failed to bind
Подробнее здесь: https://stackoverflow.com/questions/175 ... sted-array
Мобильная версия