title: Binding abstract action parameters in WebAPI
body: <p>I'm in a situation where I need to bind an incoming HTTP POST request with data in the body, to a concrete type depending on a <code>ProductType</code> denominator in the data. Here is my Web API 2 action method:</p>
  
  <pre><code>[HttpPost, Route]
  public HttpResponseMessage New(ProductBase product)
  {
      // Access concrete product class...
  
      if (product is ConcreteProduct)
          // Do something
      else if (product is OtherConcreteProduct)
          // Do something else
  }
  </code></pre>
  
  <p>I was first thinking of using a custom model binder, but it <a href="http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api">seems like</a> it isn't possible to access the request body at that point:</p>
  
  <blockquote>
    <p>For complex types, Web API tries to read the value from the message
    body, using a media-type formatter.</p>
  </blockquote>
  
  <p>I can't really see how media-type formatters solves this problem, but I'm probably missing something. How would you solve this problem?</p>