I have put together a small ASP.NET MVC 2 site that does some very extensive date mining/table-joins/etc.
Using MVC, I have a controller that returns the data in many
It is possible to wrap any arbitrary LINQ query in a SqlDependency, including EF Linq queries, see LinqToCache. But unfortunately the way EF chooses to formulate the SQL for the queries, even the most simple from t in context.table select t
, is incompatible with the Query Notificaiton restriction and the SqlDependency is invalidated straight away as an invalid statement. I have talked about this in SqlDependency based caching of LINQ Queries.
What you can do is use SqlChangeMonitor
with straightforward SqlCommand
objects constructed as simple SELECT ... FROM Table
on your tables that are likely to change. You need to understand that there is a balance between the cost of setting up notifications and the cost of polling, if your tables change frequently then monitoring for changes could turn out to be more expensive than polling. See this article The Mysterious Notification to understand how QN works and what is the cost of monitoring.