title: How do I dispose of resources after an ASP.NET Web API request completes?
body: <p>I am attempting to expose an <code>IQueryable&lt;&gt;</code> over ASP.NET Web API and I find that I need to keep the data source open until the request completes, so that the OData query system built into ASP.NET Web API can do its job.</p>
  
  <p>OK, that sounds perfectly reasonable. But where do I dispose of the data source? I do not see any obvious place for this. Should I manage request state in the Application? What is the standard way to do this?</p>
  
  <p>Is the <code>Dispose()</code> method of the controller the appropriate place? I.e. is there a guarantee that one controller instance serves only one request or is that just an implementation detail?</p>
  
  <p>I am using ASP.NET Web API from ASP.NET MVC 4 RC.</p>