.NET MVC Action parameter of type object

前端 未结 2 1795
遥遥无期
遥遥无期 2021-01-19 17:15

If I have a simple controller routed as follows:

context.MapRoute(
            \"Default\",
            \"{controller}/{action}\",
            new { controll         


        
2条回答
  •  时光说笑
    2021-01-19 18:07

    In this case I would probably create a custom ModelBinder:

    http://buildstarted.com/2010/09/12/custom-model-binders-in-mvc-3-with-imodelbinder/

    then maybe use a dynamic object to allow for multiple types. See here

    MVC3 ModelBinder for DynamicObject

提交回复
热议问题