EntityFramework.Filters
EntityFramework.Filters copied to clipboard
Interception should plug into CSpace
to support models that have custom mappings to database. When interception runs in SSpace the mapping is already processed by EF so it only works when the code and database are the same. .
:thumbsup:
Interestingly, since I updated to version 0.3.0.0 the filters seems to not be applied at all to the queries: When I look at the SQL output, my filters are not applied. Had to downgrade to 0.2.0.0 which works, but unfortunately caches the filter expressions. So I need to use the following unpleasant workaround:
var objectContext = ((IObjectContextAdapter)Context).ObjectContext;
var all = objectContext.CreateObjectSet<TEntity>();
// Note we have to disable query cache because our filter convention (UsersFilter) from EntityFramework.Filter
// modifies the query before it gets cached --> the parameters become constants!!
var oq = all as ObjectQuery;
oq.EnablePlanCaching = false;
Did you change anything on the API?
No, to my knowledge I did not change the API. I did change the interception to occcur on CSpace (from SSpace). Could you provide me with a gist or sample to show when the filter is not applied correctly.
I do exepect that you must set EnablePlanCaching to false to make Filters work properly and the queries is cached inside EF.