title: Can I do model-level filtering in Entity Framework?
body: <p>In the latest version of Lightswitch, they have added a query pipleline method that allows you to catch all query requests to the database, and add a filter. This allows you to add (for example) a filter that restricts the data to ones whose "active" flag is true, without having to worry about doing this on every query you write.</p>
  
  <p>Now, given that the database level stuff in Lightswitch is all built on Entity Framework, I was wondering if there is something similar there. I am working on a very large project, with loads of queries in around 50 or 60 separate repositories, and don't really want to have to ask every developer to go through every query in every repository and add code to check the active flag. Apart from the time involved, the chances of missing a query are high, as are the chances of someone forgetting to include it in a future query.</p>
  
  <p>Anyone know if this can be done at a low level in Entity Framework? Thanks</p>