I have various types of EF objects, all have a navigation property called "Employee". When creating reports, the user will be able to filter the report in accordance with various skills of employees (Cost Center, gender, etc.).
I am currently filtering each request separately, for example:
var courses = context.Courses
.Where(c => c.Employee.CostCenterID == ccID
&& c.Employee.Rank == rankID
....
)
.ToList();
The actual filter code is much longer, but it was just a hint. In any case, is there a way to create a common method for filtering the result by an employee? all the objects that I put on this filter method will have a navigation property Employee. I just put IQueryable<entity>or ObjectSet<entity>, and then get filtered IQueryable<entity>or ObjectSet<entity>.
How to do it?