custom-model-binder

    3熱度

    1回答

    給予相同的動作: public ActionResult DoStuff([CustomAttribute("foo")]string value) { // ... } 有什麼辦法來解決value「一個ModelBinder的內小號CustomAttribute的實例?我正在查看MVC源代碼,並且可能我只是做錯了,但是當我嘗試複製它們爲複雜模型檢索BindAttribute的代碼

    7熱度

    1回答

    我需要實現一個功能,允許用戶以任何形式輸入價格,即允許10美元,10美元,10美元...作爲輸入。 我想通過爲Price類實現自定義模型聯編程序來解決此問題。 class Price { decimal Value; int ID; } 的形式包含一個數組或價格作爲鍵 keys: "Prices[0].Value" "Prices[0].ID" "Prices[1].Value" "P

    0熱度

    2回答

    我爲我創建的ASP.NET MVC應用程序創建了一個新的ActionFilter。我有一個接受Http Post的動作,action方法的參數接受一個對象,爲此我創建並註冊了一個自定義模型聯編程序。 我注意到IActionFilter.OnActionExecuting內爲filterContext.Controller.ViewData.Model值始終null儘管它看起來像模型粘合劑的動作過濾

    23熱度

    4回答

    自定義模型粘結劑,我有以下的控制器操作: [HttpPost] public ViewResult DoSomething(MyModel model) { // do something return View(); } 凡MyModel看起來是這樣的: public class MyModel { public string PropertyA {ge