title: ASP.NET WebAPI: Generic controller for OData endpoint
body: <p>I'm currently experimenting with OData endpoints in ASP.NET MVC 4 Web API. I like the concept and try to come up with efficient ways to use it in our project. 
  One question I have is the following: we have a service that is able to return an IQueryable and takes the name of an entity as Input:</p>
  
  <pre><code>public IQueryable GetAll(string entityName);
  </code></pre>
  
  <p>In standard Web API (as opposed to OData Controllers) I can create a generic controller, that can be called in the form /api/entities/{entityName} and returns the IQueryable.
  In case of an OData Controller, I carry out the following entity-specific steps:</p>
  
  <ol>
  <li>Register the entities in the model.</li>
  <li>Create a separate Controller for each entity that derives from EntitySetController&lt;>.</li>
  </ol>
  
  <p>I want to use the generic service and avoid as much entity-specific implementations as possible. The first step can easily be automated if the service can return a list of the entities and the corresponding types.
  That leaves step 2, because up to now I need to create a specific controller for each entity. I also want to avoid that and create a generic controller that uses the generic service. </p>
  
  <p>Can anyone recommend a solution, maybe by influencing OData routing?</p>