Using entity framework I have implemented soft delete & data level restriction with IDbCommandTreeInterceptor. For the first query using the context, the interceptor gets hit. But trying again (refreshing browser), the interceptor is skipped. I have checked whether data is being cached by changing some data using SQL server management studio. The changes are reflected but the interceptor is still skipped. What could possibly be causing for this to happen?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
according to the sources comments this is expected behaviour
Command trees are created for both queries and insert/update/delete commands. However, query command trees are cached by model which means that command tree creation only happens the first time a query is executed and this notification will only happen at that time
As a consequence your interceptor result can not depend on the data.