What are the key differences between these and when should they be used? My initial understanding was that SqlCacheDependency used polling but I've read it doesn't have too for ASP.NET 2.0. I want to know which is most appropriate for caching of linq queries under ASP.NET web server. This will be ASP.NET 3.5.
- SqlCacheDependency on forum
- SqlCacheDependency
- SqlDependency
The SqlCacheDependency class also supports integration with the System.Data.SqlClient.SqlDependency class when using a SQL Server 2005 database. The query notification mechanism of SQL Server 2005 detects changes to data that invalidate the results of an SQL query and r开发者_如何学Pythonemoves any cached items associated with the SQL query from the System.Web.Caching.Cache.
Query Notification is the underlying technology. SqlNotificationRequest is the ADO.Net client support. SqlDependency is the ADO.Net infrastructure to automate the deployment of temporary objects needed by SqlNotificationRequest. SqlCacheDependency uses SqlDependency to integrate it with the ASP caching infrastructure. See more at The Mysterious Notification.
Note on them work with LINQ. See LinqToCache for a project that leverages Query Notifications with LINQ queries, and also explains why the vast majority of LINQ queries cannot use Query Notifications.
精彩评论