SqlDependency vs SqlCacheDependency

What are the main differences between them and when should they be used? My initial understanding was that SqlCacheDependency used polling, but I read that it is not too suitable for ASP.NET 2.0. I want to know what is the most suitable for caching linq queries under ASP.NET web server. This will be ASP.NET 3.5.

The SqlCacheDependency class also supports integration with the System.Data.SqlClient.SqlDependency class when using the SQL Server 2005 database. The query notification mechanism of SQL Server 2005 detects data changes that result from the SQL query and removes any cached items associated with the SQL query from System.Web.Caching.Cache.

+7
source share
1 answer

Request notification is a core technology. SqlNotificationRequest is ADO.Net client support. SqlDependency is an ADO.Net infrastructure for automating the deployment of temporary objects required by SqlNotificationRequest. SqlCacheDependency uses SqlDependency to integrate with the ASP caching infrastructure. See Mysterious Notification for more information.

A note about them works with LINQ. See LinqToCache for a project that uses query notifications with LINQ queries, and also explains why the vast majority of LINQ queries cannot use query notifications.

+11
source share

All Articles