We are using entity framework 4 to access our database. Every table has got some security related fields which we would like to check on every query (e.g. start/end date, level of security, element active or not).
Is it possible to define something like a global query interceptor that adds additional checks for the security fields? I know that query interceptors exist for WCF Data Services, but we do not use data services.
Unfortunatelly no.
QueryInterceptoris feature related to WCF Data Services and whole implementation related to its usage is internal so you can’t reuse it elsewhere without using WCF Data services.Basically
QueryInterceptoris just condition added to executed query so you can in the same way wrap your data access to the class which will expose method like: