title: Web API - How to accept comma separated list of parameter values via query string
body: <p>I have a Web API project I am working on in Visual Studio 2013, and I'd like for my Controllers to accept a comma separated list of values via the query string, similar to this:</p>
  
  <pre><code>http://localhost:12345/api/Procedures/1?embed=doctors,drugs&amp;fields=fieldA,fieldB,fieldC
  </code></pre>
  
  <p>The reason for this is that I'd like to be able to control if related resources (additional tables) are queried via custom embedding using the <strong>embed</strong> parameter, and control what fields are returned from the base object using the <strong>fields</strong> parameter.</p>
  
  <p>I've done some searching on Google but most of what is being suggested relates to extending IModelBinder (<a href="http://www.strathweb.com/2013/04/asp-net-web-api-parameter-binding-part-1-understanding-binding-from-uri/" rel="nofollow noreferrer">http://www.strathweb.com/2013/04/asp-net-web-api-parameter-binding-part-1-understanding-binding-from-uri/</a>)  or setting up a custom ActionFilterAttribute (<a href="https://stackoverflow.com/questions/10941669/convert-custom-action-filter-for-web-api-use">Convert custom action filter for Web API use?</a>) which seems like overkill for something relatively simple.  </p>
  
  <p>FYI I am using an Entity Framework dbContext class to connect to my database.</p>