title: ASP.NET MVC - Custom Model Binder on Interface Type
body: <p>I'm not sure if this behavior is expected or not, but it seems that custom model binding doesn't work when the binding is assigned to an interface type. Has anyone experimented with this?</p>
  
  <pre><code>public interface ISomeModel {}
  public class SomeModel : ISomeModel {}
  
  public class MvcApplication : HttpApplication {
      protected void Application_Start(object sender, EventArgs e) {
          ModelBinders.Binders[typeof(ISomeModel)] = new MyCustomModelBinder();
      }
  }
  </code></pre>
  
  <p>With the above code when I bind to a model of type SomeModel, MyCustomModelBinder is never hit; however, if I change the above code and substitute <code>typeof(ISomeModel)</code> for <code>typeof(SomeModel)</code> and post the exact same form MyCustomModelBinder is called as expected. Does that seem right?</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>I found myself back in this predicament over a year after I originally asked this question, and now I have a solution that works. Thank you Matt Hidinger! </p>
  
  <p><a href="http://www.matthidinger.com/archive/2011/08/16/An-inheritance-aware-ModelBinderProvider-in-MVC-3.aspx" rel="noreferrer">http://www.matthidinger.com/archive/2011/08/16/An-inheritance-aware-ModelBinderProvider-in-MVC-3.aspx</a></p>