title: Querying IQueryable completely decoupled from ORM?
body: <p>I may be completely misunderstanding what happens under the hood of an IQueryable, so if I'm wrong, I welcome correction.</p>
  
  <p>I have a log table in my database that I want to view on a front end web application using a Kendo UI table.  </p>
  
  <p>These javascript components are really slick; they can target and limit the data coming over the connection based off of many dimensions... for example, I can get the top 100 records organized by log date, filtered for DEBUG or INFO where the user was "Joe User".</p>
  
  <p>This works against an <code>IEnumerable&lt;LogEntry&gt;</code> object just fine... but there's a lot of <code>LogEntry</code> objects in the table, and I think that this should be very poorly performing as the logs table continues to grow.</p>
  
  <p>I want to implement a service like this:</p>
  
  <pre><code>public interface ILogBrowsingService
  {
      IQueryable&lt;LogEntry&gt; Logs { get; }
  }
  </code></pre>
  
  <p>... with a concrete implementation in another assembly using an ORM (EF, NHibernate, Telerik DataAccess, haven't decided) that will allow offloading some (hopefully most) of the heavy lifting of the query to the database server.  I would basically be running the query against the exposed IQueryable in the service... however, I think I will quickly run into a problem, as this service will be running under its own service-specific data context, and its own Linq-To-X implementation.  I believe I will experience issues with this implementation, dealing with database context life cycles and IQueryable support and whatnot.</p>
  
  <p>I was playing with the idea of capturing the "query" against a generic <code>IQueryable&lt;LogEntry&gt;</code> and passing it as an argument into the service to be replayed against the concrete implementation, but I have no idea how I would do that, but something along these lines:</p>
  
  <pre><code>public interface ILogBrowsingService
  {
      IList&lt;LogEntry&gt; GetLogEntryQueryResults(IQuery&lt;LogEntry&gt; query);
  }
  </code></pre>
  
  <p>I have no idea what an <code>IQuery&lt;LogEntry&gt;</code> would look like.</p>
  
  <p>I really don't want to try and write a service/ repository pattern that will incorporate the multiple permutations of searchability for this table.  Am I imagining a problem where there is none, or is there a "proper" way to accomplish what I am trying to do, completely agnostic to the ORM backend?</p>