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 类的新实例。 |