Các trang trong Ví dụ 29,42 bao gồm một chỉ với một thuộc tính SqlDependency. Giá trị của thuộc tính SqlDependency là tên của các cơ sở dữ liệu được kích hoạt cho SQL phụ thuộc vào các file cấu hình web, theo sau là tên của một bảng cơ sở dữ liệu. | 1404 CHAPTER 29 Caching Application Pages and Data ConnectionString ConnectionStrings Movies SelectCommand SELECT Title Director FROM Movies Runat server div form body html The page in Listing includes an @ Outputcache directive with a SqlDependency attribute. The value of the SqlDependency attribute is the name of the database enabled for SQL dependencies in the web configuration file followed by the name of a database table. If you open the page in Listing in your browser and click your browser s Reload button multiple times you notice that the time displayed does not change. The page is output cached see Figure . O http local host . 173 - Polling SQI Output Cache - Mozilln Firefox fn X 3 32 36 PM Title Director Titanic James Cameron Star Wars George Lucas Jurassic Park Steven Spielberg Jaws Steven Spielberg Ghost Jerry Zucker Forrest Gump Robert Zemeckis Ice Age Chris Wedge Shrek Andrew Adarnson Independence Day Roland Emmerich The Ring Gore Verbinski Done FIGURE Using Page Output Caching with a Polling SQL cache dependency. However if you modify the Movies database the page is dropped from the cache automatically within 5 seconds . The next time you click the Reload button the modified data displays. If you want to make a page dependent on multiple database tables you can assign a semicolon-delimited list of database and table names to the SqlDependency attribute. From the Library of Wow eBook Using SQL Cache Dependencies 1405 NOTE You also can use Polling SQL cache dependencies with an @ Outputcache directive included in a User Control. In other words you can use Polling SQL cache dependencies with Partial Page Caching. Using Polling SQL Cache Dependencies with DataSource Caching You can use Polling SQL cache dependencies with both the SqlDataSource and ObjectDataSource controls by setting the SqlCacheDependency property. For example the page in Listing caches the output of a SqlDataSource control until the Movies database table .