34

Is there any way I can set the default ModelBinder to one of my own?

whatupdave
  • 3,124
  • 5
  • 28
  • 32

2 Answers2

59
ModelBinders.Binders.DefaultBinder = new MyOwnModelBinder();
Paco
  • 8,335
  • 3
  • 30
  • 41
-1

In the Global.asax.cs:

public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            //...
            ModelBinders.Binders.DefaultBinder = new MyModelBinder();
        }

    }