.NET Model Binders

后端 未结 1 1269
梦毁少年i
梦毁少年i 2021-02-19 16:20

I was trying to create custom model binder in my ASP.NET MVC 4 project. But i get stuck with IModelBinder iterfaces. There are three IModelBinder interfaces VS

相关标签:
1条回答
  • 2021-02-19 17:03

    I am not MS folk but I think here is the answer -

    1. System.Web.ModelBinding is for ASP.Net WebForms applications

    http://msdn.microsoft.com/en-us/library/system.web.modelbinding(v=vs.110).aspx

    The System.Web.ModelBinding namespace provides classes that enable you to bind data objects to ASP.NET Web Forms server controls.

    1. System.Web.Mvc is for ASP.Net MVC

    http://msdn.microsoft.com/en-us/library/system.web.mvc(v=vs.118).aspx

    The System.Web.Mvc namespace contains classes and interfaces that support the ASP.NET Model View Controller (MVC) framework for creating Web applications. This namespace includes classes that represent controllers, controller factories, action results, views, partial view, model binders, and much more.

    1. System.Web.Http.ModelBinding is for ASP.Net Web API

    http://msdn.microsoft.com/en-us/library/system.web.http.modelbinding(v=vs.118).aspx

    This namespace is for Web API 2

    In short, all three frameworks are independent of each other. And you should remember that, they are separately deployable frameworks. Therefore it is necessary to keep all of them. If you don't need a particular one, then remove it from your referenced assemblies. They are not dependent to each other. They are all from separate frameworks they are all used for the purpose best fits.

    It is the feature of the intellisense or resharper like tools that they can list all. But you are the one who should pick the right one based on your framework and your need. But usually they are all available in a .net framework full version and probably serve the same work.

    0 讨论(0)
提交回复
热议问题