gpt4 book ai didi

asp.net - SqlDependency 与 SqlCacheDependency

转载 作者:行者123 更新时间:2023-12-04 10:57:59 25 4
gpt4 key购买 nike

它们之间的主要区别是什么以及何时应该使用它们?我最初的理解是 SqlCacheDependency 使用了轮询,但我读过它对于 ASP.NET 2.0 并没有太多。我想知道哪个最适合在 ASP.NET Web 服务器下缓存 linq 查询。这将是 ASP.NET 3.5。

  • SqlCacheDependency on forum
  • SqlCacheDependency
  • SqlDependency

  • The SqlCacheDependency class also supports integration with the System.Data.SqlClient.SqlDependency class when using a SQL Server 2005 database. The query notification mechanism of SQL Server 2005 detects changes to data that invalidate the results of an SQL query and removes any cached items associated with the SQL query from the System.Web.Caching.Cache.

    最佳答案

    查询通知是底层技术。 SqlNotificationRequest 是 ADO.Net 客户端支持。
    SqlDependency 是 ADO.Net 基础结构,用于自动部署 SqlNotificationRequest 所需的临时对象。 SqlCacheDependency 使用 SqlDependency 将其与 ASP 缓存基础结构集成。查看更多 The Mysterious Notification .

    请注意它们与 LINQ 一起使用。见 LinqToCache对于利用 LINQ 查询利用查询通知的项目,还解释了为什么绝大多数 LINQ 查询不能使用查询通知。

    关于asp.net - SqlDependency 与 SqlCacheDependency,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3909626/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com