title: OData attribute routing: one controller for multiple data types
body: <p>I am reading the OData V4 update blog: <a href="https://blogs.msdn.microsoft.com/webdev/2014/03/13/getting-started-with-asp-net-web-api-2-2-for-odata-v4-0/" rel="nofollow">https://blogs.msdn.microsoft.com/webdev/2014/03/13/getting-started-with-asp-net-web-api-2-2-for-odata-v4-0/</a></p>
  
  <p>It mentions the newly added [ODataRoute] attribute for attribute routing. In the traditional WebApiController, I can specify the routes by using the [Route] attributes for multiple types. For example, say I have two classes Travel and Hotel. I can have one controller for both of them by:</p>
  
  <pre><code>public class DefaultController : WebApiController {
  [Route("travel/{id}")]
  [Route("hotel/{id}")]
  public HttpResponseMessage Get(int id)
  {
     // Implementation here
  }
  </code></pre>
  
  <p>With OData stack, each data type is tied to a controller by default, which means I need two controllers:</p>
  
  <pre><code>public class TravelController : ODataController{ }
  
  public class HotelController : ODataController{ }
  </code></pre>
  
  <p>So is there a way to route multiple data types to one controller with ODataController and ODataRoute? (I tried simply replacing [Route] with [ODataRoute] but it did not work)</p>