SqlCacheDependencySection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
配置 ASP.NET 應用程式的 SQL 快取相依關係。 此類別無法獲得繼承。
public ref class SqlCacheDependencySection sealed : System::Configuration::ConfigurationSection
public sealed class SqlCacheDependencySection : System.Configuration.ConfigurationSection
type SqlCacheDependencySection = class
inherit ConfigurationSection
Public NotInheritable Class SqlCacheDependencySection
Inherits ConfigurationSection
- 繼承
範例
以下程式碼範例說明如何從現有網頁應用程式的設定檔取得該 SqlCacheDependencySection 物件。
// Get the Web application configuration.
System.Configuration.Configuration webConfig =
WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
// Get the section.
string configPath = "system.web/cache/sqlCacheDependency";
System.Web.Configuration.SqlCacheDependencySection sqlDs =
(System.Web.Configuration.SqlCacheDependencySection)webConfig.GetSection(
configPath);
' Get the Web application configuration.
Dim webConfig As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the section.
Dim configPath As String = _
"system.web/cache/sqlCacheDependency"
Dim sqlDs _
As System.Web.Configuration.SqlCacheDependencySection = _
CType(webConfig.GetSection(configPath), _
System.Web.Configuration.SqlCacheDependencySection)
備註
這SqlCacheDependencySection讓你能程式化地存取並修改設定區塊的sqlCacheDependency元素cache。
SQL 快取相依性允許快取資料與原始來源同步。 在設定儲存在 ASP.NET 應用程式快取中的項目與特定 SQL Server 資料庫資料表之間的關係後,SqlCacheDependency 類別的實例會監控該資料表,當資料表中的項目變更時,該項目會自動從快取中移除。
此元素的設定只影響物件的表格版本 SqlCacheDependency 。 2005 SQL Server及以上版本所使用的列級 SqlCacheDependency 物件不受這些設定影響。
Note
可以 SqlCacheDependencySection 根據區段屬性所定義的限制,將資訊寫入設定檔的相關區段,該屬性 AllowDefinition 的值為 MachineToApplication。 任何嘗試在階層結構中不允許的層級寫入設定檔,解析器都會產生錯誤訊息。 不過,你可以用這個類別讀取階層中任何層級的設定資訊。
建構函式
| 名稱 | Description |
|---|---|
| SqlCacheDependencySection() |
初始化 SqlCacheDependencySection 類別的新執行個體。 |