ASP.NET Syntax ASP.NET Configuration Sections
Defines the settings used by the SqlCacheDependency
class when using database caching and table-based polling against either Sql
Server 2000 or Sql Server 2005. This configuration setting has no effect when
using SqlCacheDependency in conjunction with query notifications on Sql Server
2005.configuration
Element (General Settings Schema)
  system.web Element (ASP.NET
Settings Schema)
    caching Element (ASP.NET
Settings Schema)
      sqlCacheDependency Element for
caching (ASP.NET Settings Schema)
|
<sqlCacheDependency enabled="true|false"
pollTime="number">
<databases>...</databases>
</sqlCacheDependency> |
Attributes and Elements
The following sections describe attributes, child elements, and parent
elements.
Attributes
Attribute |
Description |
enabled |
Required Boolean attribute.
Indicates whether or not changes are being polled for. |
pollTime |
Optional Int32 attribute.
Sets the frequency with which the SqlCacheDependency
polls the database table for changes. This value corresponds to the number of
milliseconds between successive pollings. It cannot be set to less than 500
milliseconds.
Default value is 1 minute. |
Child Elements
Element |
Description |
databases |
Optional element.
Contains one or more named SQL connections that can be used by the
SqlCacheDependency. |
Parent Elements
Element |
Description |
configuration |
The required root element in every configuration file used by the common
language runtime and .NET Framework applications. |
system.web |
Specifies the root element for the ASP.NET configuration settings in a
configuration file. Contains configuration elements that configure ASP.NET Web
applications and control how the applications behave. |
caching |
Configures the cache settings for a Web
application. |
Remarks
Example
The following example adds a SqlCacheDependency object to an ASP.NET
application.
 |
Copy Code |
<sqlCacheDependency enabled="true" pollTime="30000">
<databases>
<add name="Pubs" connectionStringName="PubsConn" />
</databases>
</sqlCacheDependency> |
.gif"
onload=OnLoadImage() name=toggleSwitch>Default Configuration
The following default sqlCacheDependency element is not explicitly
configured in the machine configuration file or in the root Web.config file, but
is the default configuration returned by application in the .NET Framework
version 2.0.
 |
Copy Code |
<sqlCacheDependency enabled = "true"
pollTime = "60000">
<databases>
<add name = ""
connectionStringName = ""
pollTime = "60000"/>
</databases>
</sqlCacheDependency> |