title: A generic filter method for Linq-EF queries
body: <p>I have various types of EF entities, all of them have a navigation property called "Employee". When generating reports the user will have the option to filter the report according to the different employee propertoes (Cost Center, gender, etc.). </p>
  
  <p>Currently I am filtering each query individually, for example:</p>
  
  <pre><code>var courses = context.Courses
                .Where(c =&gt; c.Employee.CostCenterID == ccID
                       &amp;&amp; c.Employee.Rank == rankID
                       ....
                      )
                      .ToList();
  </code></pre>
  
  <p>The real filter code is much more longer but this was just a hint. Anyway, is there a way to create a generic method to filter the result by the employee? all the entities I will supply to this filter method will have an <code>Employee</code> navigation property. I will simply supply a <code>IQueryable&lt;entity&gt;</code> or <code>ObjectSet&lt;entity&gt;</code> and then get a filtered <code>IQueryable&lt;entity&gt;</code> or <code>ObjectSet&lt;entity&gt;</code>.</p>
  
  <p>How to do that?</p>