SqlCacheDependencySection.Enabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定一個值,指示資料庫資料表是否應該被監控以進行變更。
public:
property bool Enabled { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("enabled", DefaultValue=true)]
public bool Enabled { get; set; }
[<System.Configuration.ConfigurationProperty("enabled", DefaultValue=true)>]
member this.Enabled : bool with get, set
Public Property Enabled As Boolean
屬性值
true若啟用 SQL 快取監控;否則,。 false 預設值為 true。
- 屬性
範例
以下程式碼範例說明如何使用該 Enabled 屬性。
// Get the current Enabled property value.
Boolean enabledValue = sqlDs.Enabled;
// Set the Enabled property to false.
sqlDs.Enabled = false;
' Get the current Enabled property value.
Dim enabledValue As [Boolean] = sqlDs.Enabled
' Set the Enabled property to false.
sqlDs.Enabled = False
備註
在設定 ASP.NET 應用程式快取中項目與特定 SQL Server 資料庫資料表之間的關係後,類別 SqlCacheDependency 的實例會監控該資料表,當資料表中的項目變更時,該項目會自動從快取中移除。
為了讓這個類別正常運作,資料庫和你想設定相依關係的資料表必須啟用通知功能。 欲了解更多資訊,請參閱本課程提供的 SqlCacheDependency 備註。
備註
取得或設定一個值,指示是否有活動 SqlCacheDependency 物件的資料庫資料表是否應該被監控變更。 此設定不影響列級 SqlCacheDependency 物件。