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
- 繼承
範例
下列程式代碼範例示範如何從現有 Web 應用程式的組態檔取得 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 。 與 SQL Server 2005 和更新版本搭配使用的數據列層級 SqlCacheDependency 物件不會受到這些設定的影響。
注意
SqlCacheDependencySection可以根據值為MachineToApplication的 section 屬性AllowDefinition所定義的限制,將資訊寫入組態檔的相關區段。 在階層中不允許的層級寫入組態檔的任何嘗試,都會產生剖析器所產生的錯誤訊息。 不過,您可以使用這個類別來讀取階層中任何層級的組態資訊。
建構函式
| SqlCacheDependencySection() |
初始化 SqlCacheDependencySection 類別的新執行個體。 |