public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var key = new Dictionary<string, object>();
key.Add("CPLID", new object());
key.Add("EqID", new object());
key.Add("Shift", new object());
key.Add("DateTime", new object());
key.Add("UpdateDateTime", new object());
key.Add("No", new object());
key.Add("LineStop.Remark", new object());
key.Add("IsRemark", new object());
key.Add("DispatchID", new object());
key.Add("CopperID", new object());
key.Add("CopperLV", new object());
key.Add("InThickness", new object());
key.Add("InWidth", new object());
key.Add("OutWidth", new object());
key.Add("OutLength", new object());
key.Add("OutPiece", new object());
key.Add("WeldingNum", new object());
key.Add("GuideNum", new object());
key.Add("Supply", new object());
key.Add("Produce", new object());
key.Add("ReturnMaterial", new object());
key.Add("StartTime", new object());
key.Add("EndTime", new object());
key.Add("PrelineNum", new object());
key.Add("SelflineNum", new object());
key.Add("ProcessModeNum", new object());
key.Add("ProcessResultNum", new object());
key.Add("ProcessMode[0].CopperID", new object());
key.Add("ProcessMode[0].Mode", new object());
key.Add("ProcessMode[1].CopperID", new object());
key.Add("ProcessMode[1].Mode", new object());
key.Add("ProcessMode[2].CopperID", new object());
key.Add("ProcessMode[2].Mode", new object());
key.Add("ProcessMode[3].CopperID", new object());
key.Add("ProcessMode[3].Mode", new object());
//key.Add("ProcessMode[4].CopperID", new object());
//key.Add("ProcessMode[4].Mode", new object());
DictionaryValueProvider<object> ob = new DictionaryValueProvider<object>(key, CultureInfo.CurrentCulture);
Assert.IsTrue(ob.ContainsPrefix("ProcessMode"));
}
}
上述樣品測試代碼的工作。在MVC3中,「ContainsPrefix」方法很好,但在MVC4中它不能正確工作。ASP.NET MVC 4 「DictionaryValueProvider <T> .ContainsPrefix()」 在運行MVC3方法錯誤
然後,當我嘗試添加更多的項目。像 ProcessMode[4].CopperID
和ProcessMode[4].Mode
(刪除評論).. 它在MVC4正常工作。
我認爲這是很奇怪的,
的問題有時會出現錯誤:「後使用JSON內容的阿賈克斯」和DefaultModelBinder
,它產生的數據,它是faule。
方法ContainsPrefix
在MVC3和MVC4中有所不同嗎?
12/7更新
http://forums.asp.net/t/1856357.aspx/1?FormValueProvider+skips+form+values
同樣的問題,它讓我不能使用MVC4
搜索前綴字符串 '二進制搜索'
使 ''和 '[' 跳過匹配
http://forums.asp.net/t/1856357.aspx/1?FormValueProvider+skips+form+values我覺得這個bug是fowllow這個論壇 –