SqlCacheDependencySection.Enabled Property

Definition

Gets or sets a value indicating whether the database table should be monitored for changes.

C#
[System.Configuration.ConfigurationProperty("enabled", DefaultValue=true)]
public bool Enabled { get; set; }

Property Value

true if SQL cache monitoring is enabled; otherwise, false. The default is true.

Attributes

Examples

The following code example shows how to use the Enabled property.

C#

// Get the current Enabled property value.
Boolean enabledValue = sqlDs.Enabled;

// Set the Enabled property to false.
sqlDs.Enabled = false;

Remarks

After you configure the relationship between an item stored in an ASP.NET application's cache and a specific SQL Server database table, an instance of the SqlCacheDependency class monitors the table so that when an item in the table changes the item is automatically removed from the cache.

For this class to work correctly, the database and any tables on which you want to set dependencies must have notifications enabled. For more information, see the remarks provided for the SqlCacheDependency class.

Anteckning

Gets or sets a value indicating whether the database tables that have active SqlCacheDependency objects should be monitored for changes. This setting does not affect the row-level SqlCacheDependency objects.

Applies to

Produkt Versioner
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also